[poppler] render PDF without annotations?
Stéphane Charette
stephanecharette at gmail.com
Mon Apr 18 09:34:25 UTC 2022
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?
Thanks,
Stephane Charette
More information about the poppler
mailing list