ShowImage
IPDFDocument4 :: Page Operations :: Graphics

See Also Example
Collapse All

This method draws an image in a PDF document.

Syntax

HRESULT ShowImage (
LONG imageNumber,
FLOAT left,
FLOAT top
)
Parameters
imageNumber
Number of an image in the PDF document's images collection

left
X coordinate of the image location

top
Y coordinate of the image location

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

This method places the image data - at the specified size (width, height) and with one corner at (left, top) - into the current content stream for the page. imageNumber is returned by any image loading method, such as AddImageFromFile.

Use the DrawImage method if you want to scale the image.

Example

Showing an Image

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
img := PDF.AddImageFromFile('image.gif');
PDF.ShowImage(img, 20, 40);
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
long img = PDF->AddImageFromFile("image.gif");
PDF->ShowImage(img, 20, 40);
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
long img = PDF.AddImageFromFile("image.gif");
PDF.ShowImage(img, 20, 40);
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
img = PDF.AddImageFromFile("image.gif")
PDF.ShowImage img, 20, 40
PDF.SaveToFile "test.pdf", true

See Also

Reference