ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / PDF functions
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
Extracts a page from a PDF file in a variable of type Image.
Example
// Extrait la page 3 du fichier texte.pdf
MonImage is Image = PDFExtractPage("texte.pdf", 3)
New in version 2024
WINDEVWEBDEV - Server code
// Extrait la page 3 du fichier texte.pdf
MonPDF is pdfDocument = PDFOpen("test.pdf")
MonImage is Image = PDFExtractPage(MonPDF, 3)
SAI_NumPagePDF.CouleurFond = White
IF SAI_NumPagePDF = 0 THEN
Info("Vous devez indiquer le numéro de page Ã  extraire")
SAI_NumPagePDF.CouleurFond = PastelRed
SetFocusAndReturnToUserInput(SAI_NumPagePDF)
RETURN
END

sNouveauChemin is string = fSelectDir(sCheminOrigine, ...
"Sélecteur de répertoire", "Sélectionnez le répertoire d'extraction de la page")

// Recherche dans le fichier de données DOC_Contact le libellé contenu dans le champ Table.
HReadSeek(DOC_Contact, IDDOC_Contact, TABLE_Fen_Liste_Documents.COL_IDDOC_Contact)
IF HFound() THEN
HourGlass()
MonCheminPDF is string = sNouveauChemin + "\" + ...
DOC_Contact.IDDOC_Contact + "." + DOC_Contact.Format

// Document est un mémo contenant le PDF
IF NOT HExtractMemo(DOC_Contact, Document, MonCheminPDF) THEN
Error(HErrorInfo())
ELSE
IF PDFNumberOfPages(MonCheminPDF) < SAI_NumPagePDF THEN
Error("Le PDF ne contient pas suffisamment de pages", "Traitement annulé")
RETURN
END

MonImagePDF is Image = PDFExtractPage(MonCheminPDF, SAI_NumPagePDF)
// Suppression du PDF d'origine
fDelete(MonCheminPDF)

MonImagePNG is string = sNouveauChemin + "\" + DOC_Contact.IDDOC_Contact + ...
"_Page" + SAI_NumPagePDF + ".PNG"
dSaveImagePNG(MonImagePDF, MonImagePNG)
ShellExecute(MonImagePNG)
END
HourGlass(False)
END
Syntax

Extract an Page from a PDF file identified by an path Hide the details

<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>: entier
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.
New in version 2024
Android Syntax not available in Android

Extract a page from a PDF file identified by a variable of type pdfDocument Hide the details

<Result> = PDFExtractPage(<PDF document> , <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.
<PDF document>: pdfDocument variable
Name of the pdfDocument variable that corresponds to the PDF document to use.
<Page number>: entier
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: wd290wdpdf.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/22/2023

Send a report | Local help