Render all pages in PDF to Images concurrently

Discussions about PDF management.
Post Reply
nth
Posts: 6
Joined: Wed Mar 28, 2018 11:17 pm

Render all pages in PDF to Images concurrently

Post by nth » Thu Jul 07, 2022 4:22 pm

We are wanting to scan an entire PDF for Barcodes. To do this (based on all online samples and demos), each page in the PDF must be converted to a GdPicture object using RenderPageToGdPictureImage/Ex. It appears that this must be done by looping through each page in the document and doing them one by one. This is taking a long time on documents that have several pages (as most of ours do). Trying to run them in a parallel loop leads to inconsistent results (i.e. pages being missed etc). Is there a way to take a GdPicturePdf object and get a collection of GdPictureImage id's in one single call without the looping (like a Render All Pages to GdPictureImage)? I haven't seen anything like that. Or better yet, a way to scan for barcodes without converting the PDF pages to images? I haven't seen anything like that either.

Thanks

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: Render all pages in PDF to Images concurrently

Post by Fabio » Mon Jul 11, 2022 6:53 pm

Hello there,

If your PDF is image-based, the best option is to convert your input PDF into a temporary TIF document and loop on its images.
Let me know if this solution does not fit or if you need any help.

Best regards,
Fabio

nth
Posts: 6
Joined: Wed Mar 28, 2018 11:17 pm

Re: Render all pages in PDF to Images concurrently

Post by nth » Mon Jul 11, 2022 10:12 pm

Is there an easy way in GdPicture to check if a PDF is Image Based? Is the an example of converting the input PDF into a temporary TIF and looping it's pages? What would i need to do inside the loop? Are there any examples?

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: Render all pages in PDF to Images concurrently

Post by Fabio » Tue Aug 02, 2022 10:18 am

Hello,

To check if your PDF is image-based, you can check:
- If there is some text on the page: https://www.gdpicture.com/guides/gdpict ... lean).html
- If there is an image: https://www.gdpicture.com/guides/gdpict ... nt().html?

If PageHasText == false & GetPageImageCount == 1 you can consider the page is image based.

For converting your PDF into a TIF, you can follow this code snippet: https://www.gdpicture.com/guides/gdpict ... mages.html

Best regards,
Fabio

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest