PDA

View Full Version : Editing existing PDF file



Aslund
4th December 2015, 12:20
Hello fellow Qt programmers

I got the task of developing a small program logging program. One of the requirements is to print the result to a PDF file.

My idea is to have an existing PDF made like a form and use Qt to insert the different values at the appropriate places.

I have tried to use QPdfWriter but it deletes the existing form using this example:
http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=552&key=QPdfWriterColoredTexts

Any ideas how to make it work or alternatively, another approach?

Kind regards
Sebastian Aslund

d_stranz
5th December 2015, 23:18
I have tried to use QPdfWriter but it deletes the existing form using this example

Well, yes, of course it replaces the original file (if it exists) because that's what the code in the example has been told to do.

There is no built-in Qt support for reading and modifying PDF files. If you are working on a linux platform, you might be able to use a library like Poppler.

nameispalmer
6th June 2018, 10:00
Quite a necro, but this thread is still pretty popular, so I think it would be nice to explain things here some more. Speaking of QPDFWriter, the point of the tool is to write data in the PDF extension but nothing more than this. It means that it could write your values as a different file but not layer. For such purposes, you need an editor, like this one for example https://boston-real-estate-board-form.pdffiller.com/ not just a simple writer. Have no clue if Qt has something similar with this feature, but doubting that, it would be way more complicated piece of code