Print Page | Close Window

Performance when adding text elements

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3240
Printed Date: 22 Nov 24 at 11:10PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Performance when adding text elements
Posted By: x3mike
Subject: Performance when adding text elements
Date Posted: 04 Jan 16 at 4:54PM
Hello,

I have to "watermark" existing PDF documents with some text elements. The process take a really long time.

For some tests I used this document I googled in the internet: http://scholar.princeton.edu/angelab/publications/super-large-pdf-100mb" rel="nofollow - http://scholar.princeton.edu/angelab/publications/super-large-pdf-100mb

What I do:
  • create TMemoryStream and load the data into it
  • create a TQuickPDF instance and load the document from the memorystream
  • Iterate each page, select it and add two text elements
  • save the document back to the stream and save the stream to a file

On my machine this process takes 80 seconds!

How can I speed up the process? This kind of PDF-processing is used on a WebServer which dynamically adds user data to the delivered PDF. A processing time of average 40seconds totally blocks the server ...

Thank you for your help!

Best regards,
Michael




Replies:
Posted By: Ingo
Date Posted: 07 Jan 16 at 8:49PM
Hi Michael,

do you think it's faster to do the first two steps instead of using an easy LoadFromFile (into memory as well)?
The same for the last step: An easy SaveToFile should be faster.
But all this saves time at the beginning and at the end. Most of the time will be consumed while working on the pages.
Here's a sample from the Debenu-knowledgebase about watermarking. If you do it the same way i fear there's no further time save option:
http://www.debenu.com/kb/programmatically-add-watermark-stamp-pdf/

BTW: A 100-mb-file on disk could be a much bigger file if it's loaded and structured into the memory.

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk