Amélioration de la génération de PDF
- Mise à jour automatique du nombre de pages dans le CSS - Intégration des bookmarks dans le PDF final
This commit is contained in:
parent
69e29917de
commit
ca4d9a1518
3 changed files with 60 additions and 2 deletions
10
Makefile
10
Makefile
|
|
@ -20,13 +20,19 @@ help:
|
|||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
# Default make weasyprint target has a bug so we have to call it manually on the generated index.html file
|
||||
# Then we execute count_pdf_pages.py that will count the number of pages, and update print-theme.css
|
||||
# Then we generate index.pdf again (with the correct number of pages in the footer)
|
||||
# After that, extract table of content data from the pdf and generate a .tex file
|
||||
# Then generate a toc.pdf from the .tex file
|
||||
# And put them together in a .pdf file
|
||||
# Finally, we generate the final PDF by adding the bookmarks (for easier navigation in the PDF)
|
||||
# After all, clean up
|
||||
pdf: weasyprint
|
||||
weasyprint build/weasyprint/index.html build/weasyprint/index.pdf -s source/css/print-theme.css
|
||||
python3 sphinx-tools/count_pdf_pages.py
|
||||
weasyprint build/weasyprint/index.html build/weasyprint/index.pdf -s source/css/print-theme.css
|
||||
./pdftoc-to-latex build/weasyprint/index.pdf > build/weasyprint/toc.tex
|
||||
- pdflatex -interaction nonstopmode -output-directory=build/weasyprint build/weasyprint/toc.tex
|
||||
pdftk A=build/weasyprint/index.pdf B=build/weasyprint/toc.pdf cat A1 B A2-end output build/weasyprint/vheliotech.pdf
|
||||
rm build/weasyprint/index.pdf build/weasyprint/toc.tex build/weasyprint/toc.pdf build/weasyprint/GuidedemontageVheliotech.pdf
|
||||
pdftk A=build/weasyprint/index.pdf B=build/weasyprint/toc.pdf cat A1 B A2-end output build/weasyprint/vheliotech-without-bookmarks.pdf
|
||||
python3 sphinx-tools/update_pdf_bookmarks.py build/weasyprint/index.pdf build/weasyprint/vheliotech-without-bookmarks.pdf build/weasyprint/vheliotech.pdf
|
||||
#rm build/weasyprint/index.pdf build/weasyprint/toc.tex build/weasyprint/toc.pdf build/weasyprint/GuidedemontageVheliotech.pdf
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue