[Solved] Convert Text file to pdf file in Qt
-
There is no direct way to do this.
@Either use the Poppler "here ":http://doc.qt.digia.com/qq/qq27-poppler.html
or
Use PdfWriter class like a paint device, read the contents of text file and write them to paint device using QPainter->drawText(...).@
-
hii
and also you can use QPrinter class. -
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().
@QTextDocument doc;
doc.setHtml(doc_content);QPrinter file;
file.setOutputFormat(QPrinter::PdfFormat);
file.setOutputFileName("myfile.pdf"); // better to use full path
doc.print(file);@This isn't tested by me, so the capitalisation of the methods might not be right, but is should give an idea.
-
hi mikesoft
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=53Thanks
Bala Beemaneni