Print Page | Close Window

DrawText method slows down on large files

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=683
Printed Date: 16 May 24 at 6:55PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawText method slows down on large files
Posted By: mburian
Subject: DrawText method slows down on large files
Date Posted: 18 Mar 07 at 8:16PM
Hello All,
 
I am using the DrawText method to create a PDF document from a Text file.
 
I am finding that at around 3000 pages the process slows down considerably and by target of 15000 pages is never reached.
 
Could someone guide me in what factors to look for or be aware of when creating large PDF files?
 
Snippet of code below:
 
    Do While Not EOF(hFile)  ' Loop until end of file.
        Line Input #hFile, mytextline ' Read line into variable.
        
        'Output text
        X = 1
        Y = Y + Line_Space
               
        'Draw text line
        Call QP.DrawText(X, Y, mytextline)
        
       
    Loop


-------------
Mick Burian



Replies:
Posted By: ukobsa
Date Posted: 19 Mar 07 at 12:17AM
Mick,

maybe I have an idea why it is slowing down. Can you make such a large pdf available? (if not too large: please mail it to support(at)quickpdf.org)


Ulrich


Posted By: mburian
Date Posted: 19 Mar 07 at 1:16AM
Hi,
 
The file being converted is a "text" file.  Is this the file you would like?


-------------
Mick Burian


Posted By: ukobsa
Date Posted: 19 Mar 07 at 3:14AM
Mick,

I have done a short test doing the following:

- create fresh QuickPDF document
- add 5000 new pages
- on each page draw 30 text strings

well, this last really a lot of time. I have tested it with a profiler and this shows me, that there are some procedures that really could need some optimizations (causing the long processing). So for the moment I cannot see anything to improve the performance without coding.

It's maybe a silly question but if you simply want to convert some kind of a text file to PDF: can't you do that by printing the file on a PDF Printer like FreePDF?


Ulrich


Posted By: Ingo
Date Posted: 19 Mar 07 at 3:27AM
Hi Uli!

Can you tell me the relevant procedures?

Best regards,
Ingo



Posted By: ukobsa
Date Posted: 19 Mar 07 at 3:52AM
Ingo,

have a look for
- TPDFName.Output
- TPDFPainter.MakeFloat
- TPDFPainter.AddString
- TPDFFont.FixText

all of them make massive string operation with '+' which is causing a lot of internal string copying in Delphi. If this can be reduced then the procedures should be faster (especially when they are very often called).

I'll send you the track from my profiler by email.

HTH,
Uli


Posted By: Ingo
Date Posted: 19 Mar 07 at 4:48AM
Hi Uli!

Thanks. I think since friday the community (we) should do the job again ;-)
If everyone just does a little bit ... we'll get something big for all ;-)

Best regards,
Ingo



Posted By: swb1
Date Posted: 19 Mar 07 at 10:01AM

Delphi strings have a reputation for being slow. I am not certain this is true; however there are many discussions in internet groups covering various solutions to the string concatenation problem.

 

A quick suggestion though: look to see whether large strings are passed into functions as var parameters or if they can be. This can help avoid making a copy of the string each time the function is called.

 

Regards,

 

Steve



Posted By: marian_pascalau
Date Posted: 19 Mar 07 at 11:28AM

Hi there,

if you realy bother only about text information why don't you use SetPageContents function (function name may differ). Produce a demo page grab it's contents, create your own content template and reproduce contents for each page.

PS: pay carefull attention on fonts and images.
 
Best regards, Marian


Posted By: mburian
Date Posted: 02 Apr 07 at 3:26PM
Hi,
 
Sorry for not replying sooner.
 
My process is generic in that every text file converted has different page dimensions which affect the scale factor of the text on each line. 
 
This is why I thought that I needed to process each line.  I also need page breaks which are inserted in the text file.
 
I hope this helps and thanks for all of your input.
 
Mick


-------------
Mick Burian



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