This class represents a PDF document. It enables its content to be read and rendered. The class behaves like a read-only array. This is how you create a new PDF document of type PdfDocument from a PDF file in Gambas:
Dim hPdfDocument As PdfDocument hPdfDocument = New PdfDocument ( Path As String [ , Owner As String, Password As String ] )
You can use the PdfPage class to return a specific page of a PDF document as a virtual object based on its index. Index is a value between 0 and the value of the property PdfDocument.Max = PdfDocument.Count -1.
Dim hPdfDocument As PdfDocument Dim hPdfPage As PdfPage hPdfPage = hPdfDocument [ Index As Integer ]
The PdfDocument class has the following properties:
Property | Data type | Description |
---|---|---|
Antialiasing | Boolean | Returns or sets the value whether or not antialiasing is used for drawing pages. |
Author | String | Returns the author of the PDF document. |
Count | Integer | Returns the number of pages of the PDF document. |
Max | Integer | Returns the number of pages of the document minus one; Max = Count -1. |
CreationDate | Date | Returns the date on which the PDF document was created. |
Creator | String | Returns the creator of the PDF document. |
Producer | String | Returns the producer of the PDF document. |
Index | .PdfDocumentIndex | Returns the index (table of contents) of a PDF document as a virtual object of type .PdfDocumentIndex. |
Keywords | String | Returns a comma-separated list as a string. |
Linearized | Boolean | Specifies whether the document is linearised or not. Linearisation of PDF content enables efficient incremental access to the PDF file in a network environment. |
ModificationDate | Date | Returns the date the PDF document was last modified. |
Resolution | Float | Returns or sets the resolution of the PDF document in DPI. |
Rotation | Integer | Returns or sets the global page rotation in degrees. The value must be a multiple of 90: 0, 90, 180 or 270. The rotation angle can also be negative, for example -90. |
Subject | String | Returns the subject of the PDF document. |
TextAntialiasing | Boolean | Returns the value or sets whether the text is anti-aliased when drawing a page. |
TextHinting | Boolean | Returns the value or sets whether text hinting was used when drawing a page. |
Title | String | Returns the title of the PDF document. |
Version | String | Returns the version of the PDF document as a string. |
Table 23.12.1.1.1 : Properties of the PdfDocument class
Notes
sMessage = Format(Stat(FMain.DocumentPath).LastChange, "dd.mm.yyyy hh:nn:ss") Print sMessage
The PdfDocument class only has one method:
Method | Return type | Description |
---|---|---|
Find ( Label As String ) | Integer | Returns the page index of the page that has the identifier 'Label'. If no page was found, -1 is returned. |
Table 23.12.1.2.1 : Method of the PdfDocument class
On the page https://wiki.ubuntuusers.de/poppler-utils/ you will find a brief description of command line programmes from the poppler-utils collection, which you can use to obtain information about PDF documents or convert them into an XML file, for example.
Here is an example of reading the fonts used in a PDF document, which is not possible using the Gambas component gb.poppler:
hans@pc-a-mint20:~/Dokumente$ pdffonts k23.12.pdf name type encoding emb sub uni object ID ------------------------------------ ----------------- ---------------- --- --- --- --------- BAAAAA+LiberationSans TrueType WinAnsi yes yes yes 48 0 CAAAAA+DejaVuSansMono TrueType WinAnsi yes yes yes 33 0 DAAAAA+LiberationSans-Italic TrueType WinAnsi yes yes yes 43 0 EAAAAA+LiberationSans-Bold TrueType WinAnsi yes yes yes 38 0