Skip to main content
All docs
V26.1
  • ImageFragment Class

    An image fragment on a PDF page.

    Namespace: DevExpress.Docs.Pdf

    Assembly: DevExpress.Docs.Pdf.v26.1.dll

    Declaration

    public class ImageFragment :
        VisualFragment

    The following members return ImageFragment objects:

    Example

    How to: Add an Image to a PDF Page

    The following code snippet adds an image to a page:

    A PDF page with the DevExpress logo image skewed at 20 degrees

    using DevExpress.Docs.Pdf;
    using DevExpress.Drawing;
    using DevExpress.Drawing.Printing;
    using System.Drawing;
    using System.IO;
    
    using (PdfDocument pdfDocument = new PdfDocument())
    {
        var page = pdfDocument.Pages.Add(DXPaperKind.A4);
        // Create an image fragment.
        var image = new ImageFragment
        {
            Image = DXImage.FromStream(new FileStream("DevExpress.png", FileMode.Open, FileAccess.Read)),
            Location = new PointF(100, 100),
            SkewX = 20,
        };
        // Add the image to the page.
        page.AddFragment(image);
    
        pdfDocument.Save(new FileStream("Result.pdf", FileMode.Create, FileAccess.Write));
    }
    

    Implements

    Inheritance

    See Also