How to convert text to pdf in php
Viewed 21k times. I've seen this but the examples don't show how to use a text file as input. Improve this question. Tell us a little bit more about why you need to do textfile to pdf coversion. Is this some kind of batch job? What is the context? Yes its a batch job, it'll convert fairly large text documents about 1MB into pdf files. There isn't need for many features, except perhaps being able to insert images or links at the top of the file.
Apart from that it would just look like a text file. Wanting to modify the text file as opposed to just converting it makes a huge difference. For a simple conversion, you dont need PHP. So if you want to modify the PDF, please be as specific as possible about what you are trying to do. Just a header at the beginning of the PDF file with a logo. Add a comment. Active Oldest Votes. Improve this answer. Gordon Gordon 1, 4 4 gold badges 16 16 silver badges 32 32 bronze badges.
With his own definition of "simplest and shortest", we are just comparing apple and orange. Stack Overflow's multiple screen names rule! Jay true, but then again, it's up to the OP to provide proper requirements — Gordon. Pekka Pekka k gold badges silver badges bronze badges. Gordon Gordon k 69 69 gold badges silver badges bronze badges.
You can use MPDF. Community Bot 1 1 1 silver badge. Todua T. Todua Sign up or log in Sign up using Google. Improve this answer. Pedro Lobito Pedro Lobito 82k 28 28 gold badges silver badges bronze badges. Thanks a lot That class is very useful. In this I want just a url from pdf. Any way to find that? The class includes an output buffer flush that can cause 'headers already sent' errors. Seemingly no ill-effects if you disable it for any reasonable size of document.
Yes, class is not working for all. Do you have any other suggestion? You may want to try pdfparser. Show 1 more comment. Sebastien Malot Sebastien Malot 3 3 silver badges 9 9 bronze badges. Don't seem to be getting output with your script. Do you have a PDF it could be tested against?
This worked for me! Thanks — kakoma. I've found a good one here: github. You can use too this PHP library: pdfparser. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.
Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
0コメント