I have document source in XML.
I need to generate PDF and HTML pages from it, and the problem is HTML and PDF copies should look exactly the same (if in PDF dcument on 2nd page, the first word in 3rd row is “computer”, then in HTML it has to be the same). Also I need to print out this document from web browser and page layout should also be the same.
I need advise, what tools to use and how better realize this solution.
Also it is preferrable to do this with PHP/javascript, not java…
Margins, font sizes may be different, I just need to make position of words absolutely the same in all copies. The document format is quite simple, it looks like a book.
I was thinking to generate PDF first and then show it in web-browser and use it for printing, but I’m
You’ll never get identical PDF and HTML copies as you must generally go via a rendering engine and, as we know from using different browsers and operating systems, rendering engines often don’t render equal code equally.
Similarly, when a user prints a page, the page is re-rendered as a ‘print’ layout; it doesn’t use the regular stylesheet, unless we set
media="all". But even then, there are differences to the printed version:So unless your styling is very simple, you won’t get similar print/browser views. Even if the styling is simple, that’s all you’ll get: similarity, not an identical page.