[Gambas-user] gb.poppler question

Gianluigi gradobag at gradobag.it
Fri Jan 19 23:30:53 CET 2024


Hi Guys,

this code (*) correctly returns the UNI format (I hope).
I believe, however, that there is an ad hoc property (PdfAction.Type?) 
to do this with gb.poppler.
Do any of you know it and can share?
Attached project

Thanks and regards
Gianluigi

(*)
Public Sub Main()

   Dim hPdf As PdfDocument
   ' Dim hAction As PdfAction
   Dim sPath, sType As String
   Dim iHeight As Integer

   sPath = Application.Path &/ "test.pdf"
   hPdf = New PdfDocument(sPath)
   ' Try hAction = New PdfAction
   ' Try sType = hAction.Type ' <------------Segmentation 
error!!!!!!!!!!!!!!!
   ' If Error Then Print Error.Text

   iHeight = Round((hPdf[0].Height / hPdf.Resolution) * 25.4)
   Print iHeight
   sType = ReturnType(iHeight)
   Print sType

End

Private Sub ReturnType(iHeight As Integer) As String

   Dim aList As String[] = ["Custom", "A3", "A4", "A5", "B5", "Letter", 
"Executive", "Legal"]
   Dim i As Byte

   Select iHeight
     Case 420
       i = 1
     Case 297
       i = 2
     Case 210
       i = 3
     Case 250
       i = 4
     Case 279
       i = 5
     Case 330
       i = 6
     Case 356
       i = 7
     Case Else
       i = 0
   End Select
   Return aList[i]

End
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestPdf-0.0.1.tar.gz
Type: application/gzip
Size: 19208 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20240119/f65b49d4/attachment-0001.gz>


More information about the User mailing list