We help IT Professionals succeed at work.
Get Started

Determine DPI (resolution) used in Acrobat document with API

2,250 Views
Last Modified: 2012-06-27
I'm extracting pages to a JPG image (using the JSObject), however I want to know the Height and Width (in inches) of the Page before I extract it (so I can store it for later use).

I can get the X and Y in pixels, but need to know the DPI of the document.  I know that the standard normally is 72 (so just oPage.GetSize.x / 72 should equal the width in inches), however, I could have sworn I've seen some documents (that I created) with other DPI settings.

Is there a way to determine the current DPI setting of the page/document?
		Dim oDoc As New Acrobat.AcroPDDoc
		Dim oApp As New Acrobat.AcroApp
 
		If oDoc.Open("test.pdf") Then
			Dim oJS As Object = oDoc.GetJSObject()
 
			Dim oPage As Acrobat.AcroPDPage
			oPage = oDoc.AcquirePage(0)
 
			Dim oSize As Object
			oSize = oPage.GetSize
 
' HOW DO I DETERMINE THE DPI IN ORDER TO GET THE SIZE IN INCHES?
 
			MsgBox(oSize.x)
			MsgBox(oSize.y)
 
			oJS.SaveAs("c:\temp\test.jpg", "com.adobe.acrobat.jpeg", True)
			oJS.console.show()
			oJS.console.clear()
		End If
 
		oDoc.Close()

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE