PDA

View Full Version : Pdf generating tool(3rd party api's) for Qt Creator



rohitkk
19th November 2013, 13:18
Hi everyone,

Is there any 3rd party api's for generating pdf in Qt Creator, same as iTextPdf (viz. used for manipulating PDF in java)?

Pls reply ASAP.

Regards,
Rohit

anda_skoa
19th November 2013, 15:24
If you mean generating PDF with Qt, then yes, QPrinter can directly output to PDF.
If you indeed mean QtCreator I am afraid I don't understand the question.

Cheers,
_

ChrisW67
19th November 2013, 20:24
If you need to manipulate the content of existing PDF files then Qt does not directly help.

You can use any C-based PDF library, any C++ based library built with a compatible compiler, or any ActiveX based option (on Windows only of course). Take your pick.

rohitkk
20th November 2013, 04:54
@anda_skoa : I don't know, does it make any difference (sorry if it does) ,basically i am new to this technology & i am facing certain problems with Qt pdf generation .
I am able to generate PDF with Qprinter but there are many drawbacks of it as follows (faced by me):
• New Page issue: Code has to be written for new page when page is getting overflowed.
• Un-even Spacing between words & letters: Spacing between alphabets is coming making pdf look uncanny (weird).
• Dynamic space (height/width) calculation: Dynamic space (height) calculation cannot be done.
• Fixed cell height: If cell’s data is large it is not displayed in the cell.

Pls, suggest any api's for PDF generation or help me to fix above issues.

@ChrisW67 : Can u pls name any of them such that it is easy for me to google it, because i've already searched a whole lot & still no solution found.

Regards,
Rohit Kashyap.

Added after 22 minutes:

I was searching on net & found following api's :
o Poppler
o Hummus &
o PoDoFo
but i am not able to find any further solution on how to use them.

ChrisW67
20th November 2013, 05:27
Poppler is a fairly complete GPL PDF implementation. Of course, Adobe offer libraries in this area.

PDF is a page description format, not a desktop publishing engine or report generator. The PDF support in Qt is designed to output PDF as a printer. Pagination is handled by the software doing the printing not by some automagic mechanism that knows where to break content.

If you re trying to write something like a word processor then you should look at QTextDocument which has some pagination abilities.
If you want some sort of report generator then you could look at KDAB's KDReports.

rohitkk
20th November 2013, 12:06
@ChrisW67 :Thank you for ur fast reply & i was searching for KDReports by KDAB , not much info on net was found. I've downloaded KDReports from https://customers.kdab.com/download.php & after using it in Qt it keeps on giving certain errors as there is not much documentation provided.
If you have any sort have of info. pls post it.

Regards,
Rohit

patrik08
20th November 2013, 12:56
Long time a go i write Miniscribus.. a smal clone of http://www.scribus.net/canvas/Scribus
many tousend of download..
Today i use docx or odt opendocument as template... in programm, but on xml subformat you can draw all items and color..
https://code.google.com/p/fop-miniscribus/
Qt can write pdf & ps postcript file... rtf docx odt and many others..

http://fop-miniscribus.googlecode.com/svn/trunk/fop_miniscribus.2.0.0/miniscribus2.0.0.png

Added after 31 minutes:

Last week i write a converter from pdf to html i try on qpoppler on pdftohtml... and recompose as html..
http://dconv-server.googlecode.com/svn/trunk/console_doc/doclib/pdfhtml.cpp
the result is nice but font rendering is not perfect..

the best converter i found after is a 700kb javascript code.. lol...
this small piece convert all font to openfont and after you render a first class result on browser without!!! Adobe Reader or plugins..
https://github.com/mozilla/pdf.js
http://andreasgal.com/2011/06/15/pdf-js/
so you can extract complex html to draw a better result as poppler... :-)

patrik08
21st November 2013, 23:25
Here i found other libs..
I find by http://wiki.scribus.net/canvas/Building_SVN_versions_with_CMake#MS_Publisher_and_ WPG_Importers
http://podofo.sourceforge.net/about.html
What is PoDoFo?

PoDoFo is a library to work with the PDF file format. The name comes from the first letter of PDF (Portable Document Format). A few tools to work with PDF files are already included in the PoDoFo package.

The PoDoFo library is a free, portable C++ library which includes classes to parse PDF files and modify their contents into memory. The changes can be written back to disk easily. The parser can also be used to extract information from a PDF file (for example the parser could be used in a PDF viewer). Besides parsing PoDoFo includes also very simple classes to create your own PDF files. All classes are documented so it is easy to start writing your own application using PoDoFo.

PoDoFo is written in C++ and the code was sucessfully compiled under Unix, Mac OS X and Windows.

rohitkk
22nd November 2013, 06:12
Hi,
Pls provide info. on how to set environment for KDReport.

Added after 31 minutes:


Poppler is a fairly complete GPL PDF implementation. Of course, Adobe offer libraries in this area.

PDF is a page description format, not a desktop publishing engine or report generator. The PDF support in Qt is designed to output PDF as a printer. Pagination is handled by the software doing the printing not by some automagic mechanism that knows where to break content.

If you re trying to write something like a word processor then you should look at QTextDocument which has some pagination abilities.
If you want some sort of report generator then you could look at KDAB's KDReports.

Hi,
Can u pls provide information on how to integrate & use KDReports in Qt.

Thanks in advance.
Regards,
Rohit Kashyap