PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns an Image type variable containing a page from a PDF file.
Android This function is now available for Android applications.
Example
// Extracts page 3 from the text.pdf file
MyImage is Image = PDFExtractPage("text.pdf", 3)
EDT_NumPagePDF.BackgroundColor = White
IF EDT_NumPagePDF = 0 THEN
Info("Specify a page page number to be extracted")
EDT_NumPagePDF.BackgroundColor = PastelRed
SetFocusAndReturnToUserInput(EDT_NumPagePDF)
RETURN
END
 
sNewPath is string = fSelectDir(sOriginalPath, ...
"Directory selector","Select the page extraction directory")
 
// Search in the DOC_Contact data file for the text contained in the Table control.
HReadSeek(DOC_Contact, DOCID_Contact, TABLE_Win_Document_List.COL_DOCID_Contact)
IF HFound() THEN
HourGlass()
 
MyPDFPath is string = sNewPath + "\" + ...
DOC_Contact.DOCID_Contact + "." + DOC_Contact.Format
 
// Document is a memo that contains the PDF file
IF NOT HExtractMemo(DOC_Contact, Document, MyPDFPath) THEN
Error(HErrorInfo())
ELSE
IF PDFNumberOfPages(MyPDFPath) < EDT_NumPagePDF THEN
Error("The PDF document does not contain enough pages", ...
"Process canceled")
RETURN
END
 
MyPDFImage is Image = PDFExtractPage(MyPDFPath, ...
EDT_NumPagePDF)
// Delete original PDF
fDelete(MyPDFPath)
 
MyPNGImage is string = sNewPath + "\" + DOC_Contact.DOCID_Contact + ...
 "_Page" + EDT_NumPagePDF + ".PNG"
dSaveImagePNG(MyPDFImage, MyPNGImage)
ShellExecute(MyPNGImage)
END
HourGlass(False)
END
Syntax
<Result> = PDFExtractPage(<File path> , <Page number> [, <Width> [, <Height> [, <Password>]]])
<Result>: Image (image variable)
Image variable that contains the image of the extracted page. The returned image is a raster image (non vectorial).
Remark: If the PDF file does not exist or if the page does not exist, the Image variable returned will be invalid. The ErrorOccurred variable will correspond to True.
<File path>: Character string
Path of the PDF file from which the page will be extracted.
<Page number>: Integer
Number of the page to extract.
<Width>: Optional integer
Width at which the page must be rasterized.
If this parameter is not specified (or if this parameter is equal to 0), the height and width will be calculated from the page size (in millimeters), by considering a DPI set to 300.
<Height>: Optional integer
Height at which the page must be rasterized.
If this parameter is not specified (or if this parameter is equal to 0), the height and width will be calculated from the page size (in millimeters), by considering a DPI set to 300.
<Password>: Optional character string
Password of the PDF document.
Business / UI classification: Business Logic
Component: wd270pdf.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment