GetImageResolution
IPDFDocument3 :: General document methods

See Also Example
Collapse All

This method retrieves the resolution of the image with the specified index.

Syntax

LONG GetImageResolution (
LONG imageIndex
)
Parameters
imageIndex
Index of the image

Return value
Resolution of the specified image

Remarks

Images must have equal vertical and horizontal resolutions. When loading PDF Creator Pilot re-samples images as needed to keep resolutions equal.

The index of the image can be retrieved from any image loading method, such as AddImageFromFile.

Equivalent in new interface: IPDFDocument4::GetImageResolution.

Example

How to Keep Image Sizes the Same in Different Resolutions

Delphi
[copy to clipboard]
{ PDF object is supposed to be created   }
PDF.Resolution := 600 { set any DPI here }
PDF.BeginDoc;
i := PDF.AddImageFromFile('picture.gif');
w := PDF.GetImageWidth(ind);
h := PDF.GetImageHeight(ind);
r := PDF.GetImageResolution(ind);
coeff := PDF.Resolution / r;
{ Show image in 100% sizes but in PDF page's resolution }
PDF.PDFPAGE_ShowImage(i, 10, 10, w*coeff, h*coeff, 0.0);
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->Resolution = 600; // set any DPI here
PDF->BeginDoc();
LONG i = PDF->AddImageFromFile("picture.gif");
LONG w = PDF->GetImageWidth(ind);
LONG h = PDF->GetImageHeight(ind);
LONG r = PDF->GetImageResolution(ind);
DOUBLE coeff = (DOUBLE)PDF.Resolution / r;
// Show image in 100% sizes but in PDF page's resolution
PDF.PDFPAGE_ShowImage(i, 10, 10, w*coeff, h*coeff, 0.0);
PDF.EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.Resolution = 600; // set any DPI here
PDF.BeginDoc();
long i = PDF.AddImageFromFile("picture.gif");
long w = PDF.GetImageWidth(ind);
long h = PDF.GetImageHeight(ind);
long r = PDF.GetImageResolution(ind);
double coeff = (double)PDF.Resolution / r;
// Show image in 100% sizes but in PDF page's resolution
PDF.PDFPAGE_ShowImage(i, 10, 10, w*coeff, h*coeff, 0.0);
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.Resolution = 600 ' set any DPI here
PDF.BeginDoc
ind = PDF.AddImageFromFile("picture.gif")
w = PDF.GetImageWidth(ind)
h = PDF.GetImageHeight(ind)
r = PDF.GetImageResolution(ind)
coeff = PDF.Resolution / r
' Show image in 100% sizes but in PDF page's resolution
PDF.PDFPAGE_ShowImage i, 10, 10, w*coeff, h*coeff, 0.0
PDF.EndDoc

See Also

Reference