Append HTML content to PDF using python - Stack Overflow

admin2025-04-19  4

My problem is that I have a pdf with existing data in it. Now I have html file with me that contains data like paragraph, tables, images etc. What I want is to render the HTML file data with its formatting and append it to my existing pdf. The catch here is that I do not want this HTML content to start from new page. I want to start it from the index where my existing pdf's content is finished. If data in existing pdf ends at line 2 then I want HTML content to start from line 3 and not directly from entire new page.

My problem is that I have a pdf with existing data in it. Now I have html file with me that contains data like paragraph, tables, images etc. What I want is to render the HTML file data with its formatting and append it to my existing pdf. The catch here is that I do not want this HTML content to start from new page. I want to start it from the index where my existing pdf's content is finished. If data in existing pdf ends at line 2 then I want HTML content to start from line 3 and not directly from entire new page.

Share Improve this question edited Jan 30 at 5:21 globglogabgalab 5683 silver badges19 bronze badges asked Jan 28 at 16:27 Jitendra TankJitendra Tank 12 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

PDF cannot import HTML it needs to be a PDF overlay onto a PDF page thus the common method since 1995 (before HTML became more popular) is called PDF over stamping.

The stamping is sometimes incorrectly called watermarking since it is blocking the existing page contents. There are many ways this can be called from python which has no native PDF abilities so like a simple CMD just needs to call a library.

转载请注明原文地址:http://anycun.com/QandA/1745009570a90343.html