6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeでAsciiDocからPDFを作成するときに画像が表示されない

Last updated at Posted at 2021-03-08

TL;DR

対策①

絶対パスで画像を指定するといいよ!

sample.adoc
image::/C:/Users/YOU_NAME/Documents/figure01.png[]

対策②

AsciiDoc機能拡張のオプション項目Use Workspace Rootにチェックを入れておいて、相対パスで画像を指定するといいよ!
image.png

sample.adoc
image::figure01.png[]

環境

OS: Windows10 Home 20H2
VSCode: 1.54.0
VSCode Extention: AsciiDoc v2.8.7
wkhtmltopdf: v0.12.6.20210114 ←今回は使用していませんでした

現象

相対パスで画像表示しようとするとプレビューには表示されますが、PDF 出力したときに画像が抜けている状態になっている。

原因

不明。
編集中のファイルに対してカレントフォルダの設定が編集中のファイルのあるフォルダに指定させていなかったため。

謝辞

@gemmaro さんのコメントに着想を得て、ちょっと違う形になりましたが修正前の記事よりよい内容になりました。
この場を借りて感謝申し上げます。

6
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?