GdPicture.NET.14.API
GdPicture14 Namespace / GdPictureDocumentConverter Class / PdfForceImageDPI Property
Example





In This Topic
PdfForceImageDPI Property (GdPictureDocumentConverter)
In This Topic
Specifies the DPI for images when converting them to PDF format. This property allows overriding the default DPI of the images used in the conversion process.
Syntax
'Declaration
 
Public Property PdfForceImageDPI As Integer
public int PdfForceImageDPI {get; set;}
public read-write property PdfForceImageDPI: Integer; 
public function get,set PdfForceImageDPI : int
public: __property int get_PdfForceImageDPI();
public: __property void set_PdfForceImageDPI( 
   int value
);
public:
property int PdfForceImageDPI {
   int get();
   void set (    int value);
}

Property Value

The default value of this property is 0, which means the DPI of the original image will be preserved in the converted PDF, and no overriding will occur.
Example
Converting and saving a JPEG image to a single PDF document.
Using gdpictureDocumentConverter As New GdPictureDocumentConverter()
    Dim status As GdPictureStatus = gdpictureDocumentConverter.LoadFromFile("image.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG)
    If status = GdPictureStatus.OK Then
        MessageBox.Show("The file has been loaded successfully.", "GdPicture")
        gdpictureDocumentConverter.PdfImageQuality = 50
        gdpictureDocumentConverter.PdfForceImageDPI = 72
        status = gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The file has been saved successfully.", "GdPicture")
        Else
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture")
        End If
    Else
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture")
    End If
End Using
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    GdPictureStatus status = gdpictureDocumentConverter.LoadFromFile("image.jpg", GdPicture14.DocumentFormat.DocumentFormatJPEG);
    if (status == GdPictureStatus.OK)
    {
        MessageBox.Show("The file has been loaded successfully.", "GdPicture");
        gdpictureDocumentConverter.PdfImageQuality = 50;
        gdpictureDocumentConverter.PdfForceImageDPI = 72;
        status = gdpictureDocumentConverter.SaveAsPDF("output.pdf", PdfConformance.PDF);
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The file has been saved successfully.", "GdPicture");
        }
        else
        {
            MessageBox.Show("The file has failed to save. Status: " + status.ToString(), "GdPicture");
        }
    }
    else
    {
        MessageBox.Show("The file has failed to load. Status: " + status.ToString(), "GdPicture");
    }
}
See Also