You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > PDF Creation > Low-level Functions > PdfAddImageFromFile > PdfAddImageFromFile Method (Integer, String, Boolean)
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.PdfAddImageFromFile Method (Integer, String, Boolean)

Adds an image from file to a PDF. This function takes a parameter to define if the image must be treated as image mask.

C#
public int PdfAddImageFromFile(
    int PdfID, 
    String ImagePath, 
    Boolean ImageMask
);
Visual Basic
Public Function PdfAddImageFromFile(
    ByVal PdfID As Integer, 
    ByVal ImagePath As String, 
    ByVal ImageMask As Boolean
) As Integer
Parameters
Parameters 
Description 
PdfID 
A PDF identifier returned by the PdfNewPdf(), PdfOCRStart(), PdfOcrStartStream(), TwainPDFStart() or TwainPdfStartStream() function. 
ImagePath 
The full image file path.  
ImageMask 
Only for 1BPP (1 Bit Per Pixel)image! Indicates whether the image shall be treated as an image mask (False by default). See sample below. 
Returns

Returns an incremental Pdf image number if success, else 0. This pdf image number can be used with the PdfDrawImage() function.

Supported formats are RAW, PICT, BMP, DIB, RLE, ICO, EMF, WMF, GIF, ANIMATED GIF, JPEG, JPG, JPE, JFIF, PNG, TIFF, MULTIPAGE TIFF, PNM, PPM, PBM, PGM, PFM, RPPM, RPGM, RPBM, PCX, XPM, XBM, WBMP, TGA, SGI, Sun RAS, PSD, MNG, Kodak PhotoCD files, KOALA files, JP2, J2K, JNG, JBIG, IFF, HDR, Raw Fax G3, EXR, DDS and Dr. Halo files.

Drawing an image as Mask.

Dim PdfID As Integer
Dim PdfImageIdx As Integer
 
PdfID = oGdPictureImaging.PdfNewPdf("c:\newpdf.pdf")
oGdPictureImaging.PdfSetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitMillimeter)
PdfImageIdx = oGdPictureImaging.PdfAddImageFromFile(PdfID, "c:\1bppimage.tif", True)
oGdPictureImaging.PdfNewPage(PdfID, 210, 297) 'A4 format
oGdPictureImaging.PdfDrawFilledCircle(PdfID, 105, 148.5, 80, Color.Blue)
oGdPictureImaging.PdfSetFillColor(PdfID, Color.Red)
oGdPictureImaging.PdfDrawImage(PdfID, PdfImageIdx, 0, 0, 210, 297)
oGdPictureImaging.PdfEndPdf(PdfID)
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.