stijn0713 Posted June 6, 2013 Share Posted June 6, 2013 Anybody experience with dompdf? i follow the basics to make a pdf from html using $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("factuur.pdf"); It seems i can't open a pdf created with dompdf if i echo something or if there is html besides the html contained by $html. anybody know why? Link to comment https://forums.phpfreaks.com/topic/278856-dompdf/ Share on other sites More sharing options...
DavidAM Posted June 6, 2013 Share Posted June 6, 2013 Never worked with it. But it is likely that it is sending the raw PDF data with a proper Content-Type header. If you send any other output, then the data received by the browser is NOT a valid PDF file. If you want to modify or augment the output, you should probably load the HTML into a DOM object, do the updates in the DOM, generate the DOM to an HTML string, then load THAT string into the DOMPDF. Edit: Unless, of course, DOMPDF, has methods for allowing you to do the changes directly to that object. Link to comment https://forums.phpfreaks.com/topic/278856-dompdf/#findComment-1434503 Share on other sites More sharing options...
stijn0713 Posted June 6, 2013 Author Share Posted June 6, 2013 i guess you are right, but i don't understand the solution. I opened the pdf file with notepad, and the problem is that all the html content is included before the actual %PDF-1.3 line. I guess a solution would be to put the intended content with the css in an outputbuffer and write in to a file, and then in that file i make pdf? (is this similiar to what you meant DavidAM?) Link to comment https://forums.phpfreaks.com/topic/278856-dompdf/#findComment-1434505 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.