ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / PDF functions
  • Conversion from PDF to text
  • Special cases
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 text from a PDF document.
Example
MyString is string
MyString = PDFToText("C:\Temp\MyDocument.pdf")
// Display in a multiline edit control
EDT_EditMultiText = MyString
New in version 2024
iPhone/iPad
MyPDF is pdfDocument = PDFOpen("test.pdf")
MyString = PDFToText(MyPDF, "1-2")
// Display in a multiline edit control
EDT_EditMultiText = MyString
Syntax

Extracting the content of a PDF file identified by its path Hide the details

<Result> = PDFToText(<PDF file> [, <Pages to extract> [, <Password> [, <Options>]]])
<Result>: Character string
Text of PDF file.
<PDF file>: Character string
Name and path of PDF file to analyze.
<Pages to extract>: Optional character string
Range of pages the text must be extracted form. The format used is identical to the one used in the standard printout boxes: individual page numbers of range of pages separated by semi-colons. For example, "1;3;4;6-10;12" means that pages 1, 3, 4, 6 to 10, and 12 will be processed.
If this parameter is not specified or if it corresponds to an empty string (""), all the pages are extracted.
<Password>: Optional character string
Password required to open the file if the PDF file is password protected.
<Options>: Integer constant
Text splitting mode:
pttCompatibleSplit PDF text using the algorithm from versions 24 and earlier.
pttDefault
(Default value)
Split PDF text using an optimized algorithm. This splitting may be different from previous versions.
New in version 2024
Android Syntax not available in Android

Extracting the content of a PDF document present in a PDFDocument variable Hide the details

<Result> = PDFToText(<PDF document> [, <Pages to extract>])
<Result>: Character string
Text of PDF file.
<PDF document>: pdfDocument variable
Name of the pdfDocument variable to be used.
<Pages to extract>: Optional character string
Range of pages the text must be extracted form. The format used is the same as the one used in standard print dialog boxes: individual page numbers of range of pages separated by semi-colons. For example, "1;3;4;6-10;12" means that pages 1, 3, 4, 6 to 10, and 12 will be processed.
If this parameter is not specified or if it corresponds to an empty string (""), all the pages are extracted.
Remarks

Conversion from PDF to text

  • The formatting of the document is lost when the conversion is performed from PDF to text.
  • The text is extracted in the order or appearance of the PDF commands and it is sequentially written into the result string. The organization of the text in paragraphs and in blocks is kept (as well as the CR characters).
  • The Unicode characters are not returned.
  • The data found in a PDF form is not extracted (this data is not stored in the PDF file).

Special cases

  • PDFIsProtected is used to find out whether a password is required to open a PDF file.
  • PDFNumberOfPages returns the total number of pages found in a PDF file.
  • Android Starting with version 28, this function is supported by 32-bit ARM processors only if the pvtCompatible constant is used. New PDF features require a 64-bit execution mode.
    If an application is to be run on devices with 32-bit ARM processors, it must be generated with WINDEV Mobile 27.
Business / UI classification: Business Logic
Component: wd290wdpdf.dll
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 04/10/2024

Send a report | Local help