Printing (physically) documents from a DOM (XML) object - PHP?
I'm interested to see if there are any features in PHP (mostly because that's the only thing I know) that 开发者_如何学编程makes it easy to paper-print forms or documents created from the content of an XML (DOM object). I've been searching around on Google, but I'm not having much success finding results related to physical printing. The XML will have basically orders from customers. I'd like to print each orders on each page.
If there are no such feature, I can resort to print on the browser and printing that on paper! I'm not sure, but are there any terms for doing things like this so I can Google-search better? My searches return "printing" on the browser.
Any suggestions or comments? TIA!
You need to transform your XML into something printable first. This example shows how to transform it to HTML.
You'll also want to make sure you're using a @media print
CSS to correctly format your doc for printing.
You can use the XSL extension to transform your source XML to an XSL-FO document via XSLT. You can then use Saxon or Apache FOP or any other processor capable of rendering the XSL-FO file to PDF.
精彩评论