[poppler] render PDF without annotations?
Albert Astals Cid
aacid at kde.org
Mon Apr 18 10:54:08 UTC 2022
El dilluns, 18 d’abril de 2022, a les 11:34:25 (CEST), Stéphane Charette va escriure:
> I'm using the Poppler CPP interface. I render to image, then convert
> to a OpenCV cv::Mat object. More or less like this:
>
> poppler::page_renderer renderer;
> std::unique_ptr<poppler::document>
> doc(poppler::document::load_from_file(filename));
> for (int page_number = 0; page_number < doc->pages(); page_number++)
> {
> std::unique_ptr<poppler::page> page(doc->create_page(page_number));
> poppler::image image = renderer.render_page(page.get(), dpi, dpi);
> cv::Mat mat(image.height(), image.width(), CV_8UC3, image.data(),
> image.bytes_per_row());
>
> While this seems to work great, I just noticed that this renders into
> the image any annotations that are saved in the PDF file as well.
> Looking through the headers, I don't see any way to tell Poppler to
> skip these annotations. Did I miss something?
No, the cpp frontend does not allow skipping annotations when rendering a page.
If you want to add the feature it should be relatively easy. Patches welcome.
Cheers,
Albert
>
> Thanks,
>
> Stephane Charette
>
More information about the poppler
mailing list