Performance - LoadPDF

Performance - LoadPDF

Forum member · Jul 16, 2009
Hi, i have several PDF files in a folder and want to read their properties (f.e. PDF Version, Creator, Pagecount ...) Using the loadPDF method of the document object for opening and reading the property information is not very powerful, because i have to create the document object before LoadPDF and have to destroy it after LoadPDF again. LoadPDF seems to add every new loaded document to its page array and therfore some properties (f.e. pagecount) show the sum of all PDF documents which were loaded by LoadPDF and not only the properties of the last loaded document. Is there an other ways to get the properties of a PDF document faster ? If not i would reguest to add a new method to the document object like "MyPDFDocument.Close" which initialises the document object without the need to delete and create the object every time. Best regards, Olaf

Re: Performance - LoadPDF

Support · Jul 16, 2009
Hello Olaf, You can set the document object to Nothing when ever you want to clear the earlier document content loaded in it. Then you can load another document without any problem. Below is a VB6 sample code which shows this. If this is not your requirement then please be more specific about your requirement so that we can help you further. 'Create the document object Dim MyDocument As New Document 'Get the list of PDF files Dim list(4) As String list(0) = "D:\Attachments\fw9AcroForm_03.pdf" list(1) = "D:\Attachments\CommentedPDF.pdf" list(2) = "D:\Attachments\TextField.pdf" list(3) = "D:\Attachments\check.pdf" For i = 0 To 3 'load the document MyDocument.LoadPdf list(i) 'get the properties Dim author As String author = MyDocument.author Dim creator As String creator = MyDocument.creator Dim count As Integer count = MyDocument.PageCount 'displaying the properties MsgBox ("Author::" & author & "/ Creator::" & creator & "/ Page Count::" & count) 'set the document to nothing and again you can load another new document Set MyDocument = Nothing Next Thanks, ceTe Software Support Team.

Re: Performance - LoadPDF

Forum member · Jul 16, 2009
Hello, thanks for your reply. Your sample shows exactly what i mean. My question was about the performance of this 3 steps inside teh for next loop of your sample, which are: 1. create the document object 2. LoadPDF 3. destroy the object. Out of my experience this is not a very performant way, because the object must be created, destroyed, created, destroyed ...for each iteration inside the loop. That needs a lot of time and CPU and therefore it might be useful for 200 iterations in a loop, but in my case i have 22000 iterations in the loop ! So i made the proposal for adding a new method like "document.close" or "document.clear" which would reset the document object internally without the need of destroying and re-creating it.

Re: Performance - LoadPDF

Support · Jul 16, 2009
Hello, Our product is designed keeping the performance in mind. In your case you will have to load the PDF document each time in the for loop as the PDFs are unique. After getting the data we are setting it to nothing. The Nothing keyword is used to disassociate an object variable from an actual object. The Set statement is used to assign Nothing to an object variable. This will set the default values to the object (previous documents will be cleared). You can load another document in the loop again. This may not decrease the performance. We are able to run this loop for 22000 files (avg PDF size is 20KB) in around 2 minutes. If you want to just read the information then you may also try using the PdfDocument object. Thanks, ceTe Software Support Team.