Determining Resolution for Extracting Images from PDF

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Support Staff, moderators

Post Reply
neilpitman
User
Posts: 39
Joined: Fri Jun 17, 2005 8:38 am

Determining Resolution for Extracting Images from PDF

Post by neilpitman » Fri Jun 17, 2005 8:47 am

In image-only PDF files, many group 3 tiff images will be from faxes which can have resolutions such as 204dpi x 98dpi

Before using PDFXCp_SaveImageFromPage we need to be able to correctly determine the image object size from the PDF file, in order to be able to correctly set xDPI and yDPI - setting to some default such as 200 x 200 will result in an incorrectly scaled image.

Is there a way we can this?

John - Tracker Supp
Site Admin
Posts: 8205
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Fri Jun 17, 2005 9:58 am

Hi,

Not possible as of today - but this weekend we will be releasing the Version 3.5 update which has a function (XCPage) to retrieve an object from a page and determine its properties and if neceesary during extraction to modify its properties and parameters - thus allowing you to achieve the desired results.

you can preview the help file from this link for the new v3.5 :

http://www.tracker-software.com/XCPro35Help.zip
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

neilpitman
User
Posts: 39
Joined: Fri Jun 17, 2005 8:38 am

Post by neilpitman » Fri Jun 17, 2005 10:05 am

As long as there is only one image per page, using PDFXCp_GetMediaBoxForPage and PDFXCp_GetDIBImageFromPage enables us to get the size , height and width.

John - Tracker Supp
Site Admin
Posts: 8205
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Fri Jun 17, 2005 10:19 am

If that suits your needs - excellent - the new library will, however give you a more comprehensive and elegant solution
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

neilpitman
User
Posts: 39
Joined: Fri Jun 17, 2005 8:38 am

Post by neilpitman » Tue Oct 04, 2005 10:20 am

We are now moving our app to 3.5 so we need to be able to use the XCPage(?) method that was mentioned above to determine the X and Y resolution of the image so that we can save it correctly. Can you provide any pointers on how to do this?

Thanks

John - Tracker Supp
Site Admin
Posts: 8205
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Wed Oct 05, 2005 11:34 am

Hi Neil,

this would allow both the image rotation options you require and extract the resolution info as required.

PXCp_ImageGetFromPage retrieves the last parameter - a pointer to the PXC_Matrix.

'a' & 'd' will be the 'width' & 'height' in points

but only if b=c=0

otherwise

width = sqrt(a*a + b*b)
height = sqrt(c*c + d*d)

where sqrt is the function required to establish the square root

Hope that helps
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com

Post Reply