Deploying PDFs along with HTML

45 views
Skip to first unread message

Federico Galetto

unread,
Feb 2, 2026, 9:28:12 PM (13 days ago) Feb 2
to PreTeXt support
Hello! New user here, having attended last week's "Getting started" workshop. Sorry if this has been answered before.

Say I work on my PreTeXt textbook in a Github repository. I can deploy to Github pages and I get this great looking website with the HTML version of my textbook. I would like people visiting the site to be able to also download a PDF version of the textbook. My question is: is it possible to deploy the PDF built by PreTeXt along with the HTML and have a link to download the PDF, preferably in an equally simple/automated way?

For example, Oscar Levin's Discrete Mathematics book has a landing page where one can "Read online" or "Download PDF". I assume the landing page is not achieved via PreTeXt, and I don't even need a landing page, just a link to download the PDF.

Thanks,
Fred

Oscar Levin

unread,
Feb 3, 2026, 4:34:40 PM (12 days ago) Feb 3
to pretext...@googlegroups.com
Yes, this is possible and is pretty easy.  In the project.ptx file, add an attribute to the "print" target: deploy-dir="pdf".  If you used the course template, the "course" target should already have a deploy-dir.  

To deploy, make sure you have built both the course and print targets first. Then doing a deploy will push both to github pages.  I think the link that is generated on the minimal landing page just points to the folder holding the pdf, but you can get a link pretty easily from that.  This is something I intend on making better soon.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/dad7ec5f-a435-4059-b92f-b3a261ff438fn%40googlegroups.com.

Federico Galetto

unread,
Feb 4, 2026, 2:59:50 PM (11 days ago) Feb 4
to PreTeXt support
Thank you! I could not make it work at first but the solution was commented out further down in the default project.ptx file.

I added the deploy-dir="pdf" attribute to the print target, and I also added the attribute output-filename="main.pdf". After that, I got a working link to the pdf file. Without output-filename the link just pointed to the pdf folder, not the file.

Note: after doing the above, I got a link to the pdf, but no link to the web version. Adding the attribute deploy-dir="web" to the "web" target, created a link to the web version. So now I have both links. :-)

Cheers,
Fred

Oscar Levin

unread,
Feb 4, 2026, 3:03:11 PM (11 days ago) Feb 4
to pretext...@googlegroups.com
Excellent.  Yes, you need a deploy-dir for each target you want to be deployed (and these should be different for different HTML targets; you could put multiple pdf targets in the same folder).

I think that we don't default to the output filename for a pdf build is a bug that should get fixed, but I'm glad you found a solution.

Reply all
Reply to author
Forward
0 new messages