Image Resolution

Because PDF is predominately vector-based, most elements print well at any resolution. However, as images are not vector based, they are not printed well at all resolutions. Ensure Images are outputted to the resolution leading to the optimal printing resolution.

DynamicPDF Core Suite for .NET does not resample or change the pixels of an image. If an image is 300 pixels wide and 300 pixels tall, it will remain the same when output to the PDF. The size of the image in points, inches, or centimeters will depend on its scale. If the scale is set to 1, it will have 1 pixel per point and output at 72 pixels per inch (also known as dots per inch or dpi). If the scale is set to 0.24, the image will have 1 pixel for every 0.24 points and output at 300 dpi.

Setting an Images DPI or Pixels Per Inch

Many image formats contain a target resolution within the file. If this information is present, it is read from the file and used as the default resolution when a scale is not specified. The default scale is 0.24 or 300 dpi if this information is not present.

To set an Image page element to a specified DPI, use the HorizontalDpi and VerticalDpi properties or the SetDpi method.

// Create an Image Page Element.
Image image = New Image( @"C:\MyLogo.gif", 0, 0 );
// Set the dpi of the image
image.SetDpi( 300 );
// Add the image to a page.
page.Elements.Add( image );        
' Create an Image Page Element.
Dim MyImage As Image = New Image( "C:\MyLogo.gif", 0, 0 )
' Set the dpi of the image
MyImage.SetDpi( 300 )
' Add the image to a page.
MyPage.Elements.Add( MyImage )

In this topic