Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - DrawText method slows down on large files
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawText method slows down on large files

 Post Reply Post Reply
Author
Message
mburian View Drop Down
Beginner
Beginner
Avatar

Joined: 10 Jul 06
Location: Australia
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mburian Quote  Post ReplyReply Direct Link To This Post Topic: DrawText method slows down on large files
    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
Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mburian View Drop Down
Beginner
Beginner
Avatar

Joined: 10 Jul 06
Location: Australia
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mburian Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 19 Mar 07 at 3:27AM
Hi Uli!

Can you tell me the relevant procedures?

Best regards,
Ingo

Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
swb1 View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 05 Dec 05
Location: United States
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote swb1 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
marian_pascalau View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 28 Mar 06
Location: Germany
Status: Offline
Points: 278
Post Options Post Options   Thanks (0) Thanks(0)   Quote marian_pascalau Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mburian View Drop Down
Beginner
Beginner
Avatar

Joined: 10 Jul 06
Location: Australia
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mburian Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store