asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
323 stars 97 forks source link

PDF export ignores image files #601

Closed ioannisstavrakakis closed 2 years ago

ioannisstavrakakis commented 2 years ago

Description

When exporting a PDF using "AsciiDoc: Export document as PDF" quick command, the resulting PDF does not show the images.

System Information

Version: 1.69.0 (user setup) Commit: 92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9 Date: 2022-07-07T05:28:36.503Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044

To Reproduce

Steps to reproduce the issue:

  1. Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  2. Select AsciiDoc: Export document as PDF
  3. Choose the folder and filename for the generated PDF

Screenshots & Files

image

Additional Context

Running the asciidoctor-pdf bash command renders the PDF as expected. testmaster.pdf

File to use for testing: test.zip

I assume there is something wrong with the new version of Visual Studio Code, 1.69.0, as in the previous version (1.68.1) it was working fine.

danyill commented 2 years ago

Try setting :data-uri: in the header. Does that help? It did for me when I tested your zip file. Perhaps we need to add this setting automatically.

On Fri, Jul 8, 2022 at 9:16 PM ioannisstavrakakis @.***> wrote:

Description

When exporting a PDF using "AsciiDoc: Export document as PDF" quick command, the resulting PDF does not show the images. System Information

Version: 1.69.0 (user setup) Commit: 92d25e35d9bf1a6b16f7d0758f25d48ace11e5b9 Date: 2022-07-07T05:28:36.503Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044 To Reproduce

Steps to reproduce the issue:

1.

Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)

2.

Select AsciiDoc: Export document as PDF

3.

Choose the folder and filename for the generated PDF

Screenshots & Files

[image: image] https://user-images.githubusercontent.com/87022642/177958936-41d27b62-3966-4847-84cd-c034f50851b2.png Additional Context

Running the asciidoctor-pdf bash command renders the PDF as expected. testmaster.pdf https://github.com/asciidoctor/asciidoctor-vscode/files/9070663/testmaster.pdf

File to use for testing: test.zip https://github.com/asciidoctor/asciidoctor-vscode/files/9070684/test.zip

I assume there is something wrong with the new version of Visual Studio Code, 1.69.0, as in the previous version it was working fine.

— Reply to this email directly, view it on GitHub https://github.com/asciidoctor/asciidoctor-vscode/issues/601, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFEXXYLEVQOC5B6M6BKFGLVS7WWHANCNFSM53AKEK7Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

-- Private or confidential message? Public Key available here https://pgp.mit.edu/pks/lookup?search=dan.mulholland%40gmail.com&op=index :

ioannisstavrakakis commented 2 years ago

Nope, same result. Exporting the PDF via the asciidoctor-pdf bash command works fine with or without the :data-uri:.

But using the PDF Export in VSC does not.

ggrossetie commented 2 years ago

@ioannisstavrakakis Which version are you using? If you are using the 3.0.0 pre-release then I'm pretty sure it's the same issue as: https://github.com/asciidoctor/asciidoctor-vscode/issues/593

ioannisstavrakakis commented 2 years ago

Yes, I am using the 3.0.0 pre-release, but I am almost sure images were working just fine in the previous VSC version. If you can test the fix you did for #593 with the sample files attached in this, that would be great.

itexnz commented 2 years ago

Confirming this too. Export to PDF from MS VS Code with PNGs fails with Error converting to PDF, Loading pages (1/6) [> ] 0% [======> ] 10% [================> ] 27% Warning: Failed to load file:///C:/......../XXXXX.png

similar to https://github.com/asciidoctor/asciidoctor-vscode/issues/332

ggrossetie commented 2 years ago

Confirming this too. Export to PDF from MS VS Code with PNGs fails with Error converting to PDF, Loading pages (1/6) [> ] 0% [======> ] 10% [================> ] 27% Warning: Failed to load file:///C:/......../XXXXX.png

That's not the same issue since you are using wkhtmltopdf, please open a new issue with a sample document to reproduce this issue.

itexnz commented 2 years ago

It happens both with or without wkhtmltopdf so I figure its the same underlying issue - EDIT: Slightly different, in wkhtmltopdf I get the error, in the AsciiDoctor PDF setting I get no images in the PDF

ggrossetie commented 2 years ago

Asciidoctor PDF and wkhtmltopdf generate PDF in two distinct ways.

Asciidoctor PDF will generate a PDF from the AsciiDoc document whereas wkhtmltopdf will generate a PDF from an HTML document.

Make sure you are using the latest version of wkhtmltopdf and if it still does not work, please open a new issue.

ioannisstavrakakis commented 2 years ago

Any news on this? Thank you!

ioannisstavrakakis commented 2 years ago

Same behavior with the updates VSC version:

Version: 1.69.1 (user setup)
Commit: b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a
Date: 2022-07-12T08:21:24.514Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19044
ggrossetie commented 2 years ago

Version 3.0.1 has been released, could you please give it a try?

Capture d’écran 2022-07-15 à 17 21 22
ioannisstavrakakis commented 2 years ago

Works like a charm! Thank you very much!

ggrossetie commented 2 years ago

Thanks for your feedback, I'm closing!

pwaugh commented 10 months ago

I have asciidoc v3.1.4 and when I use Visual Studio Code (see below) I also cannot get images into the PDF.

I get

Unable to generate a PDF using asciidoctor-pdf: Error: command failed: bundle exec asciidoctor-pdf -q -B "/Users/patrick/Documents/Repo/Morserino32-Docs" -o "/Users/patrick/Documents/Repo/Morserino32-Docs/pdf/m32-manual.pdf" -a allow-uri-read - undefined method `absolute_path?' for File:Class Did you mean? absolute_path Use --trace to show backtrace

It fails even when I set :data-uri:

Version: 1.82.0 (Universal) Commit: 8b617bd08fd9e3fc94d14adb8d358b56e3f72314 Date: 2023-09-06T22:09:41.364Z Electron: 25.8.0 ElectronBuildId: 23503258 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin x64 22.5.0

ggrossetie commented 10 months ago

@pwaugh I think the root cause is: https://github.com/asciidoctor/asciidoctor-pdf/issues/2418

tl;dr; The minimum supported version of Ruby for Asciidoctor PDF is 2.7

pwaugh commented 10 months ago

Thanks.  As I’m on a Mac, I’m using VSCODE.  I know it’s a bug as when I switch from asciidoc to the other generator, it compiles the PDF just fine.  I found another minor bug as well with the preview on VSCODE.  I’ll see if I can figure out how to properly post it. Sent from my iPhoneOn Sep 10, 2023, at 09:12, Guillaume Grossetie @.***> wrote: @pwaugh I think the root cause is: asciidoctor/asciidoctor-pdf#2418 tl;dr; The minimum supported version of Ruby for Asciidoctor PDF is 2.7

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

ggrossetie commented 10 months ago

As I’m on a Mac, I’m using VSCODE. I know it’s a bug as when I switch from asciidoc to the other generator, it compiles the PDF just fine.

Not sure what you mean by "the other generator"? 🤔 Make sure you have Ruby >= 2.7 installed on your macOS and asciidoctor-pdf should run just fine. This is not related to the Asciidoctor VS Code extension. In other words, the extension is just calling a command on your system.

I found another minor bug as well with the preview on VSCODE. I’ll see if I can figure out how to properly post it.

No worries, you can open a new issue 👍🏻

pwaugh commented 10 months ago

Yeah I changed from asciidoctor to the one that starts with a ‘w’ on the VSCODE settings.  It now works with that change.  Unfortunately, I cannot upgrade Ruby, as I’m on a Mac.  The project should not eliminate support for the prior version, for this exact reason.  As a result, Mac users are not going to adopt it.  I am translating a document into Russian for someone.  Sent from my iPhoneOn Sep 11, 2023, at 03:54, Guillaume Grossetie @.***> wrote:

As I’m on a Mac, I’m using VSCODE. I know it’s a bug as when I switch from asciidoc to the other generator, it compiles the PDF just fine.

Not sure what you mean by "the other generator"? 🤔 Make sure you have Ruby >= 2.7 installed on your macOS and asciidoctor-pdf should run just fine. This is not related to the Asciidoctor VS Code extension. In other words, the extension is just calling a command on your system.

I found another minor bug as well with the preview on VSCODE. I’ll see if I can figure out how to properly post it.

No worries, you can open a new issue 👍🏻

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>