[poppler] annotations survive in saveas copy AFTER removing them
Jannick
thirdedition at gmx.net
Fri Jul 14 15:35:54 UTC 2017
Dear All,
my code snip below suggests that 'a.pdf' is copied to 'b.pdf' AFTER
removing all annotations of a.pdf. However, b.pdf still contains all
annotations seen in a.pdf.
Am I missing something obvious here?
Thanks,
J.
// main.cpp:
#include <stdio.h>
#include <stdlib.h>
#include <PDFDoc.h>
#include <GlobalParams.h>
int main(int argc, char** argv)
{
const char* f_in = "test_in.pdf";
const char* f_out= "test_out.pdf";
GooString gf_in(f_in);
GooString gf_out(f_out);
globalParams = new GlobalParams();
PDFDoc * doc = new PDFDoc(&gf_in);
if ( doc->isOk() )
{
int i_pages = doc->getNumPages();
for ( int i_page = 1; i_page <= i_pages; i_page++ )
{
Page * page = doc->getPage(i_page);
if( page )
{
Annots * annots = page->getAnnots();
int n_annots = annots->getNumAnnots();
for ( int i_annot = 0; i_annot < n_annots ; i_annot++ )
annots->removeAnnot(annots->getAnnot(i_annot));
}
}
doc->saveAs(&gf_out,writeForceRewrite);
delete doc;
}
else
{
fprintf(stderr, "error when opening '%s'\n", f_in);
}
delete globalParams;
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170714/c6492280/attachment.html>
More information about the poppler
mailing list