-
-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding other PDFs into output #1271
Comments
Hi! WeasyPrint doesn’t offer the possibility to include other PDFs. Rendering HTML and CSS is already a big challenge, we’ve just added the PDF generation part to this challenge, I think that’s difficult enough 😉! Using third-party libraries as you do is probably the best solution for now. Is that OK for you? |
Thanks for the reply! Utilizing Naively, looking through the code, it seems like new pages are added here: WeasyPrint/weasyprint/document.py Line 1014 in 8fc505a
If I wanted to hack together a more |
I can’t really tell, it depends on how you use PyPDF2. The PyPDF2 team knows much more about PDF than we do!
As far as I know, there’s no easy way to add pages from one PDF to another. PDFs contain "objects", and copying a page means that you also have to copy the objects it contains. As these objects can reference other objects, you actually have to do this recursively. Moreover, pydyf only generates PDF files, it’s totally unable to read them. So… Use PyPDF2. pydyf can’t help you for what you want to do. |
Understood -- appreciate the clarification. Would there be any possibility so support this in the future, or should I close this issue? |
I don’t think that this feature will ever be included in WeasyPrint, it’s too complicated and out of the scope. Sorry 😒. |
Very much in search of the exact same capability: use some sort of HTML tag or CSS property to include pages from external PDFs inline. |
Can you elaborate on this workaround? I am wanting to get page numbers working when appending PDFs, and have no links to break in my docs. |
Is it possible to add other pdfs directly into a
weasyprint
output pdf? Basically interested in something like:Output PDF document:
I think there was past discussion #52, but not sure if it is exactly the same issue (and where it stands given the migration to
pydyf
).My current solution is to leverage
PyPDF2
, but the links within the document break after merging the document (open issue py-pdf/pypdf#471).The text was updated successfully, but these errors were encountered: