Skip to main content
All docs
V25.1
  • PdfGraphics.DrawImage(DXImage, PointF) Method

    Draws the specified image in its original size at the specified page point.

    Namespace: DevExpress.Pdf

    Assembly: DevExpress.Pdf.v25.1.Drawing.dll

    NuGet Package: DevExpress.Pdf.Drawing

    Declaration

    public void DrawImage(
        DXImage image,
        PointF location
    )

    Parameters

    Name Type Description
    image DXImage

    An image to draw.

    location PointF

    A point in world coordinate system where you can position an image.

    Remarks

    This method renders an image with its original resolution (DPI). The following formats are available:

    • BMP
    • JPEG
    • PNG
    • EMF
    • EMF+
    • TIFF
    • GIF
    • SVG

    The method’s dpiX and dpiY parameters do not affect image quality. They are used to convert world coordinates to page coordinates only.

    If you embed a multi-page TIFF image into the document, the PdfGraphics instance draws the active frame only (the default active frame is the first frame). Use the Image.SelectActiveFrame method to select a frame to use. The compression retains for TIFF images with CCITT T.4 or CCITT T.6 compression.

    You can use the following properties to reduce the image size and the size of the resulting PDF:

    • ConvertImagesToJpeg - Specifies whether to convert bitmap images into JPEG to reduce the size of the resulting PDF file.
    • JpegImageQuality - Gets or sets the quality of JPEG images in the resulting PDF file.

    You can also call the PdfDocumentProcessor.OptimizeDocument method to optimize PDF document images. The method parameter specifies image compression settings.

    Tip

    The PdfDocumentProcessor caches image data used as the DrawImage method parameter. If you need to draw the same image on multiple pages, you can reuse image data to improve the application performance and reduce the resulting file size.

    To draw an image on the PDF page, use one of the following methods:

    PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackground
    These methods allow you to draw content on an existing page.
    PdfDocumentProcessor.RenderNewPage
    Draws content on a new page.
    See Also