Expand my Community achievements bar.

Converting PDF to image

Avatar

Level 1

Hi,

1.We need to convert the each page of the PDF to JPG image in JAVA .

   DoLiveCycle ES APIs or any other Acrobat product provide API or SDK to do so?.

2. Is it possible to get the Orginal dimension  and the DPI  information (if the document is created in photoshop with 1667 X 1667 pixel as dimensions and DPI as 250 ) for each page.If so that is the API we can use for it.

For example:

a PDF document with

Width  :1667 px

Height :1192 px

Document Width :6.668 inches

                Height:4.768 inches

DPI is 250 pixels/inch.

When i open the same docuent in notepad I am able see the header information as /MediaBox [ 0 0 480 343 ]

and

<<
/Type /XObject
/Subtype /Image
/Interpolate false
/Filter /DCTDecode
/Width 1667
/Height 1192

/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Length 11 0 R

>>

which is nothing but (1667 /250)*72 and (1667 /250)*72.

we want the values as

Width  :1667 px and

Height :1192 px

is it possible to get?.

Regards,

Uvaraj S.

1 Reply

Avatar

Former Community Member

1. Yes.  There is a ConvertPdfService in the Foundation component in the API.  It takes a PDF document as an input, you provide a set of conversion options and you get a map/list of images back out.

2.  Yes.  If I understand what you are asking.  Through DDX you can query a PDF for DocInfo.  Part of that information contains page width and height in pixels.  Go look up the DDX reference.

Here is a sample DDX document

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">

     <PDF result="result.pdf">

          <PDF source="inDoc1" />

     </PDF>

     <DocumentInformation source="result.pdf" result="doc_info.xml" />

</DDX>

Here is a sample of the data returned in the doc_info.xml.

<DocInfo xmlns="http://ns.adobe.com/DDX/DocInfo/1.0/">
   <Title>This is a test doc</Title>
   <Author>joe@public.com</Author>
   <CreatedDate>2006-12-29T07:22:04Z</CreatedDate>
   <ModifiedDate>2009-05-15T13:35:15Z</ModifiedDate>
   <Creator>PScript5.dll Version 5.2.2</Creator>
   <Producer>Jaws PDF Creator v2.10.987</Producer>
   <Version>1.6</Version>
   <NumPages>16</NumPages>
   <FormType>NotAForm</FormType>
   <PageSizes>
     <PageSize height="842.0pt" pages="1-16" width="595.0pt"/>
   </PageSizes>
   <PageRotations>
     <PageRotation pages="1-16" rotate90="0"/>
   </PageRotations>
   <PageLabels>
     <PageLabel format="Decimal" pages="1-16" start="1"/>
   </PageLabels>
</DocInfo>