ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
443 stars 90 forks source link

Unable to fully generate PDF file, getting reference errors generating PDF outline #674

Open woodbe opened 1 year ago

woodbe commented 1 year ago

I am trying to generate a PDF using the attached adoc file (inside the ZIP). The file generates both HTML and PDF output normally (I have attached those copies for reference), but when using the web-pdf generator instead I get a number of errors output (see the log file, this is just the screen output).

The PDF and HTML files names with webpdftest are the output from the same source. The PDF file is about 75 pages instead of the 140 or so it should be (and the TOC has everything as page 0 with no links), and the HTML is also very short compared to what it should be.

The errors generated all seem to be about inforrece anchor links, but I don't see any problems when I generate the files using the more traditional asciidoctor programs.

Any help would be appreciated.

web-pdf-test.zip

This is being run from the released version for Windows (being run through Powershell).

ggrossetie commented 1 year ago

This is a know issue with Paged.js. When the Paged.js engine cannot layout an element it will skip it (i.e. truncate the document). That's the reason why some pages are missing and as a result some sections (section are missing from the table of content (more specifically section title references).

At some point, we might try to use another engine called https://github.com/vivliostyle/vivliostyle.js. Maybe it will give us better result.

If you can create a small reproduction case, I encourage you to report this issue at https://gitlab.coko.foundation/pagedjs/pagedjs/

mrombout commented 11 months ago

At some point, we might try to use another engine called https://github.com/vivliostyle/vivliostyle.js. Maybe it will give us better result.

I'm looking into Vivliostyle because I ran into some limitations with Paged.js as well.

For what it's worth I quickly ran the document through asciidoctor, asciidoctor-web-pdf and vivliostyle to get a general feel of their flow. At least it produces a ~140 page document. Obviously it needs a lot of tweaks for the style to look good.

Are there any serious plans or a vision on how Vivliostyle would fit into asciidoctor-web-pdf or the Asciidoctor ecosystem as a whole?

haekelhexe commented 8 months ago

Do I understand it correctly, that anchors in general do not work? Is there a workaround other than using vivliostyle? I would like to generate a document in order to be able to modify the css. But if I cannot create a document at all then it's not worth the effort and I have to stick to asciidoctor-pdf.

EDIT: Just saw issue https://github.com/ggrossetie/asciidoctor-web-pdf/issues/267 and this is related. So it's my table that ruins the PDF creation

ggrossetie commented 8 months ago

Do I understand it correctly, that anchors in general do not work? Is there a workaround other than using vivliostyle? I would like to generate a document in order to be able to modify the css. But if I cannot create a document at all then it's not worth the effort and I have to stick to asciidoctor-pdf.

It's not really anchors but rather missing contents. Paged.js will skip elements (i,e., contents) when it cannot figure out how to make them fit into a page.

Just saw issue https://github.com/ggrossetie/asciidoctor-web-pdf/issues/267 and this is related. So it's my table that ruins the PDF creation

Tables are notoriously difficult to gracefully chunk into multiple pages because they have a rigid/strict layout. It gets worse when the table contains images or colspans/rowspans.