I want to (and regularly use) PDF build of our docs. Currently there is no Makefile target nor manual recipe in fdp-primer how to build PDF for docs converted to asciidoc. Please provide.
carlavilla: I think we need a make target to generate PDF files, can you provide the commands to generate PDF files and then we can put them in the Makefile?
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/doc/commit/?id=4f24ed91c23be2045691a1e916e85f54f6122b70 commit 4f24ed91c23be2045691a1e916e85f54f6122b70 Author: Sergio Carlavilla Delgado <carlavilla@FreeBSD.org> AuthorDate: 2021-03-03 20:13:08 +0000 Commit: Sergio Carlavilla Delgado <carlavilla@FreeBSD.org> CommitDate: 2021-03-03 20:13:08 +0000 Add example to generate pdf document in FDP PR: 253178 Submitted by: kib@ .../en/books/fdp-primer/doc-build/chapter.adoc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
I also need to add a target in the Makefile
The recipe does not work for me. That is, handbook pdf is build (with the name book, without extension), but neither xpdf on FreeBSD nor Acrobat Reader on windows do not render anything useful. In fact xpdf error dialog spills hundreds of error messages, and Acrobat shows a 'broken file' dialog. It renders somehow in Chrome, but the fact that pdf cannot be opened by proper viewers kill the whole purpose of rendering into pdf. I used the command from the commit, verbatim: asciidoctor-pdf -r ./shared/lib/man-macro.rb -r ./shared/lib/git-macro.rb -r ./shared/lib/packages-macro.rb -r ./shared/lib/inter-document-references-macro.rb -r ./shared/lib/sectnumoffset-treeprocessor.rb --doctype=book -a skip-front-matter -a pdf-theme=./themes/default-pdf-theme.yml content/en/books/handbook/book.adoc resulting pdf is available at https://kib.kiev.ua/kib/book.pdf
Really weird, works well in my laptop. Maybe I have installed something else. Let me take a look.
I tried it, xpdf opened the file without complaint but it renders as 799 nearly-blank pages.
(In reply to Ed Maste from comment #6) xpdf has a strange way to report errors. There is a button on the bar, which becomes red when stream parse error is encountered. Then you can press it, and a dialog window with error list is displayed. Ed, did you used mine book.pdf or generated the pdf file locally?
> Ed, did you used mine book.pdf or generated the pdf file locally? I generated it locally (and was surprised to find the output generated as content/en/books/handbook/book with no extension). > xpdf has a strange way to report errors. There is a button on the bar, which becomes red when stream parse error is encountered. Then you can press it, and a dialog window with error list is displayed. Ah, I see. I have four errors reported, 2 each of 8063 Arg #0 to 'Tf' operator is wrong type (string) and 8075 No font in show/space.
I tried the same asciidoctor-pdf command on up to date Fedora Core 33, and the result it much better. The pdf renders correctly and does contain text. So it probably something with our asciidoctor/asciidoctor-pdf port that is wrong?
I believe it is prawn that is buggy or packaged with error. The following minimal example taken from prawn doc generates invalid pdf: require "prawn" Prawn::Document.generate("hello.pdf") do text "Hello World!" end Again, the error is that generated Tf pdf command has invalid font specification.
A commit references this bug: Author: sunpoet Date: Sun Mar 7 22:33:01 UTC 2021 New revision: 567782 URL: https://svnweb.freebsd.org/changeset/ports/567782 Log: Change RUN_DEPENDS from rubygem-pdf-core to rubygem-pdf-core07 - Update version requirement of RUN_DEPENDS - Bump PORTREVISION for dependency change It should fix the resulting FDP pdf file. PR: 253178 Changes: head/print/rubygem-prawn/Makefile head/print/rubygem-prawn/files/
This is the generated PDF [1] using the following command and patched rubygem-prawn (r567782). % asciidoctor-pdf -b pdf -d book -r ./shared/lib/man-macro.rb -r ./shared/lib/git-macro.rb -r ./shared/lib/packages-macro.rb -r ./shared/lib/inter-document-references-macro.rb -r ./shared/lib/sectnumoffset-treeprocessor.rb-a skip-front-matter -a pdf-theme=documentation/themes/default-pdf-theme.yml documentation/content/en/books/handbook/book.adoc asciidoctor: WARNING: image to embed not found or not readable: /tmp/freebsd-doc-main/documentation/static/images/books/handbook/wine/wine-config-1 [1] https://people.FreeBSD.org/~sunpoet/temp/freebsd-handbook.pdf
Worked for me, thanks.
Thanks Sunpoet Po-Chuan Hsieh for the fix in the rubygem-prawn library