[Solved] Convert Text file to pdf file in Qt
Hi Friends ,
How do i convert text file to pdf file in Qt C++ ?
What are the classes involved in it ?
I need to convert text file to pdf file and print it ?
Can Anyone help me please?
Thanks in advance
There is no direct way to do this.
@Either use the Poppler "here ":http://doc.qt.digia.com/qq/qq27-poppler.html
Use PdfWriter class like a paint device, read the contents of text file and write them to paint device using QPainter->drawText(...).@
and also you can use QPrinter class.
Hi Dheerendra , Iamsumit
Thanks for the reply
Do u mean C++ qt Cannot convert text file to pdf on its own?
can u provide little more information on other ways of doing if u dont mind?
It's fairly well documented but this is how I would do it?
This is just an off the top of my head, typed directly in rather than tried out attempt.
Assume that doc_content is a QString variable that contains an HTML formatted string, if it isn't HTML formatted you could load it with .setPlainText().
file.setOutputFileName("myfile.pdf"); // better to use full path
This isn't tested by me, so the capitalisation of the methods might not be right, but is should give an idea.
Thanks for ur reply.
i could do with the help of this link.
"Your text to link here...":http://www.essentialunix.org/index.php?option=com_content&view=article&id=47:generating-pdf-files&catid=34:qttutorials&Itemid=53
This is nice link...
hope your problem is solved .
Pls don't forget to prepend your title as SOLVED.