Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
General document methods
Abort
Aborted
AddColorTransformationRule
AddImageFromBitmapHandle
AddImageFromBuffer
AddImageFromFile
AddImageFromFilename
AddImageFromMemory
AddImageWithColorMask
AddImageWithMask
AddTTFFontFromFile
AddTTFFontFromFile2
AddType1FontFromFile
AutoCreateURL
AutoLaunch
BeginDoc
BinaryImage
Compression
CreateWaterMark
CurrentWaterMarkIndex
DocumentInfo_Author
DocumentInfo_CreationDate
DocumentInfo_Creator
DocumentInfo_Keywords
DocumentInfo_Producer
DocumentInfo_Subject
DocumentInfo_Title
EndDoc
FileName
FlipImage
FontEmbedStyle
GenerateInMemoryFile
GetCurrentPageIndex
GetImageCount
GetImageHeight
GetImageResolution
GetImageWidth
GetUsedDC
GetUsedDCResolution
GlyphsToUnicodeStr
HDC
InitialZoom
InitialZoom2
JPEGQuality
LastError
LoadICCProfile
LogActionsAndErrors
LogTextOperation
MakeImageGrayScale
MakeImageNegative
MemoryFileSize
MetafileImagesCompressionType
MetafileImagesJpegCompression
NewPage
NonEmbeddedFonts
NonEmbeddedFonts_Add
NotEmbedAnyFonts
OnePass
OutputByteStream
OwnerPassword
PageCount
PageHeight
PageLayout
PageMode
PageNumber
PageWidth
PlaceImageToCurrentPage
PlayEMF
PrinterForVirtualDC
Printing
ProducePDFA
ProtectionEnabled
ProtectionKeyLength
ProtectionOptions_coAssembly
ProtectionOptions_coCopyInformation
ProtectionOptions_coExtractInfo
ProtectionOptions_coFillAnnotation
ProtectionOptions_coModifyAnnotation
ProtectionOptions_coModifyStructure
ProtectionOptions_coPrint
ProtectionOptions_coPrintHigh
Resolution
SetCurrentPage
SetPDFAOutputIntent
SetPDFXOutputIntent
StartEngine
SwitchedToWatermark
TransformColors
UseCurrentDocumentResolutionForNextPages
UserPassword
UseScreenDC
Version
ViewerPreferences_vpCenterWindow
ViewerPreferences_vpFitWindow
ViewerPreferences_vpHideMenuBar
ViewerPreferences_vpHideToolBar
ViewerPreferences_vpHideWindowUI
Collapse All

This method inserts an image from a file into a PDF document and returns the index of the image. You can specify a color which will be masked (made transparent) in the image.

Syntax

LONG AddImageWithColorMask (
BSTR fileName,
OLE_COLOR colorMask
)
Parameters
fileName
Path to the image file

colorMask
Color which marks points that will be made transparent

Return value
This method returns the new image index. If there is more than one image in a file, then it returns the index of the most recently added image.

Remarks

The colorMask parameter is a double word (4 byte) value in this format: 0x00BBGGRR. The low-order byte contains a value for the relative intensity of red; the second byte contains a value for green; and the third byte contains a value for blue. The high-order byte must be zero.

The return value is an image identifier in the document's images collection and can be used in FlipImage, GetImageHeight, GetImageResolution, GetImageWidth, MakeImageGrayScale, MakeImageNegative, PlaceImageToCurrentPage, PDFPAGE_ShowImage.

Equivalent in new interface: IPDFDocument4::AddImageWithColorMask.

Example

How to Load an Image with a Color Mask

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
clr := 255; { 255=x0000FF - red color }
j := PDF.AddImageWithColorMask('picture.gif', clr);
PDF.PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
COLORREF clr = RGB(0xFF, 0, 0); // red color
LONG j = PDF->AddImageWithColorMask("picture.gif", clr);
PDF->PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
int clr = System.Drawing.ColorTranslator.ToWin32(Color.Red);
long j = PDF.AddImageWithColorMask("picture.gif", clr);
PDF.PDFPAGE_ShowImage(j, 0, 0, 122, 89, 0);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
clr = 255 '255=0x0000FF - red color
j = PDF.AddImageWithColorMask("picture.gif", clr)
PDF.PDFPAGE_ShowImage j, 0, 0, 122, 89, 0
PDF.EndDoc

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots