Extract bitmap from PDFCreator

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
durban
Posts: 26
Joined: Tue Oct 01 2002
Contact:

Extract bitmap from PDFCreator

Post by durban »

How to extract bitmap (in memory) or file from a PDF file loaded in creator ?

I need a TBitmap (delphi 7)

Thanks
Didier
Dany
Amyuni Team
Posts: 113
Joined: Wed Sep 11 2002
Location: Montreal.
Contact:

Post by Dany »

I am not sure about Delphi, but using VB you can do this quite easily by reading the BitmapData, BitmapWidth, BitmapHeight, BitsPerComponent and ColorSpace of the bitmap object.

Example:
Private Sub Command1_Click()
Dim Pic1 As acObject
Dim bytes() As Byte
Dim bmpWidth As Long
Dim bmpHeight As Long

With PDF1
.Open "c:\temp\test.pdf", ""

' make sure the control is in design mode
.DoCommandTool acCommandToolDesignMode

'create a Picture object
.CreateObject acObjectTypePicture, "Pic1"

Set Pic1 = .GetObjectByName("Pic1")
With Pic1
.Attribute("Left") = 100
.Attribute("Top") = 100
.Attribute("Right") = 400
.Attribute("Bottom") = 400

' load a sample image
.Attribute("FileName") = "C:\wutemp\test1.jpg"

' get various image attributes
bytes = .Attribute("BitmapData")
bmpWidth = .Attribute("BitmapWidth")
bmpWidth = .Attribute("BitmapHeight")

End With ' Pic1

End With ' PDF 1

End Sub
charlesd
Posts: 22
Joined: Thu Oct 20 2005
Location: Orem, Utah
Contact:

Post by charlesd »

The above approach works great for getting the raw image data in a pdf file. However, pdf files can contain quite a range of image types and color spaces that each require custom processing given only this raw data. For example some images have a "ColorSpace" attribute of "Indexed" that use a custom palette of colors. Others are encoded in RGB, CIE, etc... and require conversion before they can be handled in a standard way.

Is there any way to use the creator object to do this format-specific work for you? In other words is there a way to extract images in a uniform format?
jggori
Posts: 10
Joined: Wed Oct 18 2006

Picture attributes

Post by jggori »

Where are BitmapData and the related attributes documented. There seems to be a number of attributes related to the Picture object missing from the documentation
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

I will inform our technical writer about this and we will add the information to the next version of the documentation.

Thanks,

Joanna
Post Reply