1. Raja RAMASAMY
  2. PowerBuilder
  3. Wednesday, 19 April 2023 03:18 AM UTC

Hello all

Is there a way to get the total number of pages from a PDF document? If not using PDFDocument, is there any other way?

Thanks in advance.

 

Raja

PDFDocument lpdf_doc
long ll_return

lpdf_doc = Create PDFDocument

ll_return = lpdf_doc.importpdf( "c:\temp\sample.pdf")
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 19 April 2023 06:39 AM UTC
  2. PowerBuilder
  3. # 1

Hi.

At this point this information isn't available using PB. In PB 2022 R2, I guess, you will be able to see number of pages in a PDF file. But from what I've heard so far, R2 won't be released before July 2023. In the past I've used itext to get this kind of information. Take a look at the following question in stackoverflow:

c# - Determine number of pages in a PDF file - Stack Overflow

You could create a simple method in a similar way and use it in PB through .NET DLL Importer.

Also, if you have an old version of PDFCreator (1.6.x or 1.7.x) you can also get that information using pdfforge library that is included and documented. You can wrap the functionality you need and use it with .NET DLL Importer. You can also register the library to be used as a COM object and directly use it through PB.

If you decide to use any of those you should read their licenses.

Finally there are many commercial active-x controls that provides you that information. But you will have to pay, and of course those can be expensive.

Andreas.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.