05-18-2021 04:57 AM - edited 05-18-2021 05:02 AM
I use several versions of Diadem, and this seems a common issue on most.
If I wish to generate a report that is quite large (100 pages plus), then I notice that the ExportToPDF method appears to get slower per page as more and more pages are added. Initial pages print at an average of 1 per second, the pages towards the end take several seconds per page. Is there anything I can do to speed this up?
Below is a sample script I used to confirm my findings. One solution is to print each page separately and then merge them at the end using a separate PDF tool, but is there any way to improve the speed within Diadem?
Dim i
Dim nTimeStart
For i = 1 To 100
nTimeStart = Timer
Report.ActiveSheet.ExportToPDF "C:\Users\onkar.jagpal\Desktop\Exports\temp.pdf", TRUE
'Report.ActiveSheet.ExportToPDF "C:\Users\onkar.jagpal\Desktop\Exports\temp " & RIGHT("00" & i, 3) & ".pdf", TRUE
LogFileWrite "Page " & i & " :: " & Timer - nTimeStart
Next
Below are the timings for the 1st 10 and last 10 pages
Page 1 :: 1.070313
Page 2 :: 1.191406
Page 3 :: 1.152344
Page 4 :: 1.378906
Page 5 :: 1.238281
Page 6 :: 1.453125
Page 7 :: 1.300781
Page 8 :: 1.523438
Page 9 :: 1.375
Page 10 :: 1.660156
.
.
.
Page 90 :: 4.671875
Page 91 :: 4.714844
Page 92 :: 4.828125
Page 93 :: 5.738281
Page 94 :: 4.765625
Page 95 :: 5.023438
Page 96 :: 4.996094
Page 97 :: 4.886719
Page 98 :: 5.183594
Page 99 :: 5.007813
Page 100 :: 5.195313
05-18-2021 10:25 AM - edited 05-18-2021 10:26 AM
Hi Onkar,
The performance data you offer is expected behavior, since the PDF appending that the DIAdem command offers operates by first loading the existing PDF file into memory, appending the latest page to it in memory, then saving the larger PDF file back to disk. As the number of pages in the PDF file increases from 1 to 100, it is natural that it will take increasingly longer to load the existing PDF file into memory, causing the DIAdem PDF appending to proceed slower and slower.
There probably are other tools out there that will append a page to an existing PDF file without having to load the PDF file first, much like streaming data to a CSV file. Such tools would not suffer the same slow down in performance you document, and DIAdem creating 100 separate PDF files, one for each page, should also progress at a steady rate.
Another conceivable option would be to load all the data into DIAdem at one time to build 100 pages in DIAdem REPORT. Then you would be writing the PDF file all at once at the end of the script. I can imagine several reasons why this would not be a tenable approach for you, but I thought I'd mention it as a logical option just in case.
Regards,
Brad Turpin
Principal Technical Support Engineer
NI