You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > PDF Creation > Low-level Functions > PdfDrawImage Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.PdfDrawImage Method

Draws an image into the current page of a PDF.

C#
public PdfDrawImage(
    int PdfID, 
    int PdfImageNo, 
    Single DstX, 
    Single DstY, 
    Single Width, 
    Single Height
);
Visual Basic
Public Sub PdfDrawImage(
    ByVal PdfID As Integer, 
    ByVal PdfImageNo As Integer, 
    ByVal DstX As Single, 
    ByVal DstY As Single, 
    ByVal Width As Single, 
    ByVal Height As Single
)
Parameters
Parameters 
Description 
PdfID 
A PDF identifier returned by the PdfNewPdf(), PdfOCRStart(), PdfOcrStartStream(), TwainPDFStart() or TwainPdfStartStream() function. 
PdfImageNo 
An image number. A value returned by the PdfAddImageFromFile or the PdfAddImageFromGdPictureImage function.  
DstX 
The X destination in current unit defined by the PdfSetMeasurementUnit() function.  
DstY 
The Y destination (from the bottom) in current unit defined by the PdfSetMeasurementUnit() function.  
Width 
Width in current unit defined by the PdfSetMeasurementUnit() function.  
Height 
Height in current unit defined by the PdfSetMeasurementUnit() function.  

If the image to draw is a Mask Image, you should define the color to use for nonstroking operation using the PdfSetFillColor function.

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) 'Just turn the last parameter to False to don't use mask
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.