Skip to content

Feature : tutorials to pdf#734

Open
the-matrixneo wants to merge 2 commits intoprecice:masterfrom
the-matrixneo:feature/add-tutorials-to-pdf
Open

Feature : tutorials to pdf#734
the-matrixneo wants to merge 2 commits intoprecice:masterfrom
the-matrixneo:feature/add-tutorials-to-pdf

Conversation

@the-matrixneo
Copy link

@the-matrixneo the-matrixneo commented Feb 22, 2026

I have tested the implementation locally by ensuring the generated prince-list.txt correctly populates with URIs for both documentation and tutorials. The logic supports the full nested structure of the tutorial sidebar.

Please review the merge request
Issue no: #468

@MakisH
Copy link
Member

MakisH commented Feb 22, 2026

Thank you for the contribution! This is useful.

In the PDF I built from this PR, tutorials start from page 443. In the table of contents, I don't see anything about the tutorials. Or should I look specifically somewhere?

Also, the Quickstart tutorial (only), appears to have larger font. I guess this is because it does not yet have a sidebar (intentionally, but maybe we can rethink that decision), but then this is a separate issue.

As a side effect of including the tutorials (which have many pictures), the resulting PDF is 17MB (compared to the previous 3-4MB). If you see any easy way to reduce the size, that would be great!

In any case, I would appreciate it if you could post screenshots of any updates, or share the PDF itself, as it is currently a bit cumbersome for me to build locally.

@the-matrixneo
Copy link
Author

I will add tutorial_sidebar loop to tocpage.html (pg 443+)

To solve the size issue caused by tutorial pictures, I was confused a bit to either use an argument or to implement some variable technique.

docs: I believe we should explicitly list these optimization techniques in docs-meta-publish-to-pdf.md as this will serve as a guide for future work to ensure that the PDF remains lightweight.

@hanzalahwaheed
Copy link
Contributor

@the-matrixneo hey! solid PR!

PS. minor suggestion regarding commit history. I think its better to use git rebase if trying to bring your feature branch upto date with the master branch. This keeps the commit history much much cleaner and pays in multiples later on. You could also git squash all the commits into a single commit.

@MakisH MakisH added GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website labels Feb 23, 2026
- Updated prince-list.txt and tocpage.html to include tutorials
- Integrated --raster-images-res 150 flag in pdf-docs.sh to reduce size
- Documented optimizations in docs-meta-publish-to-pdf.md
@the-matrixneo the-matrixneo force-pushed the feature/add-tutorials-to-pdf branch from 07ca382 to efe296d Compare February 24, 2026 13:39
Copy link
Author

@the-matrixneo the-matrixneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR :

  • Table of Contents: Fixed the recursive loop in tocpage.html to correctly index tutorials.

  • PDF Optimization: Added the --raster-images-res 150 flag to pdf-docs.sh to downsample images.

  • Documentation: Updated docs-meta-publish-to-pdf.md to reflect the new build command and sidebar logic.

Image
@MakisH please have a look!!

Copy link
Member

@MakisH MakisH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is making progress and shaping up nicely! Some more comments to consider.


```bash
prince --javascript --input-list=_site/pdfconfigs/prince-list.txt -o pdf/docs.pdf
prince --javascript --raster-images-res 150 --input-list=_site/pdfconfigs/prince-list.txt -o pdf/docs.pdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Prince version are you using? I got 16.2, and it only has:

  --raster-output=TEMPLATE    Enable raster output.
  --raster-format=FORMAT      Set raster output format. [auto|png|jpeg]
  --raster-jpeg-quality=NUM   Set quality for raster JPEG output.
  --raster-pages=PAGE         Set range of pages to rasterise. [all|first|NUM]
  --raster-dpi=DPI            Set resolution of raster output.
  --raster-background=COLOR   Set background color. [white|transparent]
  --raster-threads=NUM        Set number of threads for raster output.

Comment on lines 113 to 118
pdf_sidebar: docs_sidebar
pdf_sidebars:
- docs_sidebar
- tutorial_sidebar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part needs some polishing, the example does not make much sense right now.

Comment on lines 19 to 22
pdf_sidebar: docs_sidebar
pdf_sidebars:
- docs_sidebar
- tutorial_sidebar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one of the two, no?

{% endfor %}
{% endfor %}

{% for entry in tutorial_sidebar %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before the Docs and before the Tutorials, some part separator is needed. Right now, all sections are rendered the one after the other, as if Docs and Tutorials are in the same part.

Copy link
Author

@the-matrixneo the-matrixneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the necessary changes told by you @MakisH . Please have a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants