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 - DrawImage Settings and Memory Issue
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawImage Settings and Memory Issue

 Post Reply Post Reply
Author
Message
eddy2099 View Drop Down
Beginner
Beginner


Joined: 08 Feb 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote eddy2099 Quote  Post ReplyReply Direct Link To This Post Topic: DrawImage Settings and Memory Issue
    Posted: 08 Feb 10 at 8:23AM
I am currently evaluating v7.17 and my main use of the library would be to merge images into a single pdf file.
 
1) DrawImage

I was reading up on the DrawImage method which reads
 
function TQuickPDF0717.DrawImage(Left, Top, Width, 
  Height: Double): Integer;
 
 and try the following line
 
QP.DrawImage(0,0,lWidth,IHeight);
 
It however does not draw anything but blank pages.

I found the Delphi_DCU_Convert_Image_to_PDF example and found the implementation as
 
QP.DrawImage(0, lHeight, lWidth, lHeight);
 
and that did the trick as the image filled the whole page.
 
I am actually confused here, shouldn't the 'Top' parameter refers to the top most pixel in which to place the image and not the bottom most pixel to place the image.
 
Is there an error to the component implementation or the documentation in wrong in this or I am just misinterpreting this.
 
2) Memory Issue

The second issue I have is that I would need to add some 200 odd images to a single PDF file and for my test of about 180 jpeg images, the memory usage keeps ballooning each time I add an image. Is there a way to get the library to write to file midway,  I did use the 'SetTempFile' and 'SetTempPath' but it looks like they were not being used. With 180 images, it seems to work fine as the memory usage for the program was about 600mb.

However when I added some 500 images, when it hits about 1.8gb memory usage, it stopped accepting images and reject them. Also the PDF file generated was about 6kb which was apparently in error.  Is there anything I can do to prevent this from happening ?
 
Sorry but I am new to this library. However, I must say that it is quite fast in adding the images. Overall the output looks good when it worked.



Edited by eddy2099 - 08 Feb 10 at 8:48AM
Back to Top
Shotgun Tom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 Aug 09
Location: Phoenix, AZ
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shotgun Tom Quote  Post ReplyReply Direct Link To This Post Posted: 08 Feb 10 at 5:12PM
Hi:
 
By default, a PDF's document origin is at the bottom left of the page.  You can change this using the QuickPDF Library.  See the "Set Origin" method.  If, for example, you want to set the origin to top left then the method would be QP.SetOrigin(1).  Now when you use Drawing commands it starts at the top left instead of the bottom left of the document.
 
Tom
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: 08 Feb 10 at 8:27PM
Hi Eddy!

The newest version shouldn't have problems with memory.
But if it's like you told us:
Try to make a "free" after a fix number of images and then a new "create" with the next images and so on... all appending to the first pdf-part.
Long time ago i've done it this way to avoid memory-problems.

Cheers, Ingo

Back to Top
eddy2099 View Drop Down
Beginner
Beginner


Joined: 08 Feb 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote eddy2099 Quote  Post ReplyReply Direct Link To This Post Posted: 09 Feb 10 at 1:13AM
Hi Tom and Ingo,

Thank you very much for answering my questions.

I've looked at the DAAppendFile but apparently that was the wrong direction to take since it did not really work in my case. I supposed that I could create several PDF files, perhaps 100 images per file then use MergeFileList to combine them all.

If there is any suggestions, do feel free to drop them here ;) Thanks again, you are certainly a very helpful bunch.

Edited by eddy2099 - 09 Feb 10 at 1:14AM
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: 09 Feb 10 at 6:11AM
Hi Eddy!

Here you can see what i mean with "a free from time to time":
http://www.quickpdf.org/forum/creating-large-files-very-slow_topic813_post3919.html?KW=QP.Free#3919
What's your problem with DAAppendFile? Please keep in mind that it's not possible to mix the DA-functions with the non-DA-functions!
Try the search-functionality (advanced) above with "QP.Merge"... you'll find many samples.

Cheers and welcome here, Ingo
 
Back to Top
eddy2099 View Drop Down
Beginner
Beginner


Joined: 08 Feb 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote eddy2099 Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 10 at 1:19AM
Thanks Ingo.

Sorry I am new at this. When I tried to do the DAFileAppend method, it does seems that it does not work with the DrawImage method. I read that there is a limit to what Direct Access methods and functions can do.

As such, probably my option would be to probably create say PDF of about 100 pictures each then merge them once all the 'smaller' pdfs are created.
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: 11 Feb 10 at 6:14AM
"...
When I tried to do the DAFileAppend method, it does seems that it does not work with the DrawImage method.
..."

Like i've written: Don't mix DA with non-DA ...

Cheers, Ingo
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