PageResolution
IPDFDocument4 :: Page Operations :: Common

See Also Example
Collapse All

This property gets or sets the resolution (in DPI) of the current page.

Syntax

LONG PageResolution { get; set; }
Value
The resolution value (in DPI) of the current page

Remarks

The default value is 72.

Example

How to Retain Image Size in Different Resolutions

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.PageResolution := 600; { set any DPI here }
ind := PDF.AddImageFromFile('1.jpg');
w := PDF.GetImageWidth(ind);
h := PDF.GetImageHeight(ind);
r := PDF.GetImageResolution(ind);
coeff := PDF.PageResolution / r;
{ Show image at 100% sizes but in PDF page's resolution }
PDF.DrawImage(ind, 0, 0, w*coeff, h*coeff, 0);
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->PageResolution = 600; // set any DPI here
long ind = PDF->AddImageFromFile("1.jpg");
long w = PDF->GetImageWidth(ind);
long h = PDF->GetImageHeight(ind);
float r = PDF->GetImageResolution(ind);
float coeff = PDF->PageResolution / r;
// Show image at 100% sizes but in PDF page's resolution
PDF->DrawImage(ind, 0, 0, w*coeff, h*coeff, 0);
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.PageResolution = 600; // set any DPI here
long ind = PDF.AddImageFromFile("1.jpg");
long w = PDF.GetImageWidth(ind);
long h = PDF.GetImageHeight(ind);
float r = PDF.GetImageResolution(ind);
float coeff = PDF.PageResolution / r;
// Show image at 100% sizes but in PDF page's resolution
PDF.DrawImage(ind, 0, 0, w*coeff, h*coeff, 0);
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.PageResolution = 600 ' set any DPI here
ind = PDF.AddImageFromFile("1.jpg")
w = PDF.GetImageWidth(ind)
h = PDF.GetImageHeight(ind)
r = PDF.GetImageResolution(ind)
coeff = PDF.PageResolution / r
' Show image at 100% sizes but in PDF page's resolution
PDF.DrawImage ind, 0, 0, w*coeff, h*coeff, 0
PDF.SaveToFile "test.pdf", true

See Also

Reference