dxPDFDocumentExportToImage(TdxPDFDocument,Integer,Integer,TdxSmartImage,TcxRotationAngle,TdxTaskCancelCallback) Method
Saves the specified page of the loaded PDF document with a specific target width (in pixels) to a Smart Image container
Declaration
function dxPDFDocumentExportToImage(ADocument: TdxPDFDocument; APageIndex: Integer; AWidth: Integer; AImage: TdxSmartImage; ARotationAngle: TcxRotationAngle = ra0; ACancelCallback: TdxTaskCancelCallback = nil): Boolean;
Parameters
Name | Type |
---|---|
ADocument | TdxPDFDocument |
APageIndex | Integer |
AWidth | Integer |
AImage | TdxSmartImage |
ARotationAngle | TcxRotationAngle |
ACancelCallback | TdxTaskCancelCallback |
Returns
Type |
---|
Boolean |
Remarks
This global function is designed to save a single document page as an image whose width (in pixels) is explicitly passed as the AWidth parameter. The resulting image height depends on the specified width value, retaining the source page’s height-to-width ratio. The similar dxPDFDocumentExportToImageEx global function accepts a zoom factor instead of absolute pixel width to set the source page size.
The dxPDFDocumentExportToImage global function returns True if a page from the source document is successfully saved to a Smart Image container passed as the AImage parameter; otherwise, False.
Pass the PDF Document container with the loaded source document as the ADocument parameter. Use the APageIndex parameter to pass the target page’s index within the document. Additionally, you can use the optional ARotationAngle parameter to apply the required rotation angle to the source page.
You can also provide a custom callback function to interrupt the document page export process in response to certain events in your application by passing a reference (in Delphi) or pointer (in C++Builder) to the function via the optional ACancelCallback parameter. Refer to the TdxTaskCancelCallback type description for more information.
Refer to the How to Save a PDF Document Page as a Specifically Sized Image topic for more information on the dxPDFDocumentExportToImage function (including code examples).
Note
The dxPDFDocumentExportToImage global function does not create a Smart Image container internally. You need to pass a valid instance of the TdxSmartImage class or its descendant as the function’s AImage parameter to successfully save a document page with the required settings as an image.