[poppler] Annotations with qt
fabiodurso at hotmail.it
Sun Dec 30 13:21:10 PST 2012
On Sunday, December 30, 2012 07:05:22 PM Jaydeep Solanki wrote:
> here's the source
> On Sun, Dec 30, 2012 at 11:15 PM, Jaydeep Solanki <jaydp17 at gmail.com> wrote:
> > Hi,
> > I'm trying to annotate a pdf file, but everytime I annotate a pdf, it
> > get's corrupted (Okular says it cannot open it).
> > Please point out what am I doing wrong,
> > here's my code...
> > TextAnnotation *ta = new TextAnnotation(TextAnnotation::InPlace);
> > ta->setInplaceText("Inplace");
> > pDoc->page(currentPage)->addAnnotation(ta);
> > Poppler::PDFConverter *conv = pDoc->pdfConverter();
> > conv->setOutputFileName(this->currentFileName());
> > conv->setPDFOptions(conv->pdfOptions() |
> > Poppler::PDFConverter::WithChanges);
> > conv->convert();
Albert's guess was correct, it's because you're overwriting the original file.
It doesn't happen in Okular because it always saves to a temporary file first,
then overwrites the original one.
More information about the poppler