Table of Contents
- Getting Started
- EO.Pdf- Overview
- Installation and Deployment
- Using HTML to PDF
- Using PDF Creator- Using PDF Creator
- Getting Started
- Advanced Formatting Techniques
- Interactive Features
- Low Level Content Objects
 
- Working with Existing PDF Files
- Using in Web Application
- Advanced Topics
 
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
| Using PdfImageContent | 
Follow these steps to use a PdfImageContent object:
- 
              Load the image into a System.Drawing.Image object. For example: //Load the image System.Drawing.Image image = System.Drawing.Image.FromFile("c:\\hello.gif"); 
- 
              Create a PdfImage object using the System.Drawing.Image object: //Create a new PdfImage object EO.Pdf.Drawing.PdfImage pdfImage = new EO.Pdf.Drawing.PdfImage(image); 
- 
              Create a PdfImageContent object using the PdfImage object: //Create a new PdfImageContent object EO.Pdf.Contents.PdfImageContent content = new EO.Pdf.Contents.PdfImageContent(pdfImage); 
- 
               Adjust the PdfImageContent's GfxMatrix to move the image to the desired location: //Move the image content.GfxMatrix.Translate(100, 100);
- 
               Call the PdfImageContent's AutoScale to scale the image to its original size: //Scale the image content.AutoScale();Without scaling, PDF always renders an image inside a 1 by 1 (1/72 inch by 1/72 inch) block in the user space. AutoScale automatically scales the image to its original size based on the image's pixel width/height and horizontal/vertical DPI value. Optionally, you can call Scale method on the PdfMatrix class to scale the image directly. 
- 
               Add the PdfImageContent into the page's Contents collection: //Place the image on the page page.Contents.Add(content);
Below is the full code:
//Create a new PDF document PdfDocument doc = new PdfDocument(); //Create a new page PdfPage page = doc.Pages.Add(); //Load the image System.Drawing.Image image = System.Drawing.Image.FromFile("c:\\hello.gif"); //Create a new PdfImage object EO.Pdf.Drawing.PdfImage pdfImage = new EO.Pdf.Drawing.PdfImage(image); //Create a new PdfImageContent object EO.Pdf.Contents.PdfImageContent content = new EO.Pdf.Contents.PdfImageContent(pdfImage); //Move the image content.GfxMatrix.Translate(100, 100); //Scale the image content.AutoScale(); //Place the image on the page page.Contents.Add(content);

