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!
AddImageFromFile and multipage TIF |
Post Reply |
Author | |
peteratoce
Beginner Joined: 23 Feb 07 Location: Germany Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 23 Feb 07 at 2:53AM |
I am importing scanned documents, that is, multipage TIFs that each contain a large number of pages, into PDF. The TIFs are A4, 600 dpi. I am using QuickPDF V 5.21 (the Active X variant), the program is written in VB.NET (2003).
My program basically works, in that a PDF with the intended number of pages is created that look o.k. at first glance.
When I looked further I noticed a very strange thing, though: After about 60 pages the content of the remaining pages did not change any more until the end of the 100 page PDF. That means that
AddImageFromFile(InFile, i + 1) did not add new images for i > 41, even though the return value never became 0!Have anyone of you noticed such unexpected behaviour of the AddImageFromFile function before?
Peter
|
|
ixm7
Senior Member Joined: 13 Jan 06 Status: Offline Points: 68 |
Post Options
Thanks(0)
|
In my experience, you can't rely on the return value. It is NOT an indication there are no more pages in the TIFF file.
How many ACTUAL pages are in your multi-page TIFF file? Cheers, - Ido |
|
peteratoce
Beginner Joined: 23 Feb 07 Location: Germany Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Ido, I would not expect an indication of the actual pages in the TIF file from that function call. In fact, I retrieved that information through GDI+ before starting with QuickPDF processing.
I found another problem with images and the QuickPDF library:
When you try to do the inverse processing, that is, write TIF images from PDF to file, you need first to determine the number of images available. For this there exists function FindImages().
I had created a PDF from my 100 pages TIF with the help of Acrobat (BTW, the TIF has 1200 dpi, I falsely reported 600 dpi instead in my original post). My program to extract the images crashed in function FindImages:
System.Runtime.InteropServices.COMException (0x8000FFFF): Out of memory while expanding memory stream
at iSED.IQuickPDF.FindImages() That gives the impression that the library attempts to read all existing images into memory while finding out the total number of images!
Well, I think I will abandon the idea to use QuickPDF for the handling of a large number of images per file (sigh).
Peter
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Peter!
FindImage is buggy since a long time. I'm doing the ImageCount directly in the pdf-source searching and counting the relevant image-objects. Best regards, Ingo |
|
ixm7
Senior Member Joined: 13 Jan 06 Status: Offline Points: 68 |
Post Options
Thanks(0)
|
QP.GetImagePageCount(TIFF_File) gives you the number of images inside the TIFF file. Then, loop through and bring each page in. Works fine for me.
Peter, if you email to me (ido at milletsoftware.com) the 100-page TIFF file, I can test and let you know if my routine works on it. Cheers, - Ido |
|
peteratoce
Beginner Joined: 23 Feb 07 Location: Germany Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi Ingo,
how do you access the image objects after you found them directly? My aim is to export them to a TIF file. And, to be honest, I am not too keen on delving down into the PDF itself, that's why I like to use libraries like QuickPDF...
Peter
|
|
ixm7
Senior Member Joined: 13 Jan 06 Status: Offline Points: 68 |
Post Options
Thanks(0)
|
Peter sent me a 30MB TIFF file and I tested adding the images to a PDF file using code that works very well with other (smaller) multi-page TIFF files.
I can confirm the problem he's reporting. After more than 30 minutes, the process was still churning at close to 100% CPU utilization. Peter, I suggest you contact Marian and offer to sponsor a fix for this issue. I've sponsored Marian for one enhancement to the library and he came through with a nice fix within 1 week. Cheers, - Ido Edited by ixm7 - 04 Mar 07 at 11:49AM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
"... I am not too keen on delving down into the PDF itself, that's why I like to use libraries like QuickPDF..."
Hi Peter! To be honest ... me too ;-) In my case i only want to detect that there are images - i don't want to do anything with them. Best regards, Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
Extracting textcontent from very big files with many pages i've made similar experiences... The extracting seems to stop and doesn't come to an end and all the time i've got 100% cpu utilisation. If i've many pages to extract now i free the instance after a specified pagecount, create a new instance starting with the last page+1 ... I#ve made very good experiences with it! With GetImagePageCount you know the page count and now you can make several runs with AddImageFromFile. I really think this could work for you. Best regards, Ingo |
|
peteratoce
Beginner Joined: 23 Feb 07 Location: Germany Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Ingo, I tried to process packages of only 10 pages, each with a new instance. The error occured anyway, and at the self same page of the input TIF.
So, there has to be something amiss with the design of function AddImageFromFile. I suspect that the function call tries to read all pages into memory until it finally arrives at the one that was actually asked for, instead of simply determining the offset and range of the image data for the desired page and grab that only.
Peter
|
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
Peter,
send a detail bug report to support(at)quickpdf.org . We will check this problem and confirm eventualy what you are saying.
Please send the TIFF file and a small code snippet.
Best regards, Marian
|
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
Hi Peter, sorry for delay but I had some other bugs pending. Peter I have checked your problem. The problem you have is caused by a bad QuickPDF implementation and a very bad behaviour of the default Delphi Memory manager (which creates a very bad memory fragmentation when working with large pointers). This means that when you compile the ActiveX version of QuickPDF library the normal way with Delphi then you will still get this error. But when compiled with the FastMM memory manager for Delphi it should work without problems (http://sourceforge.net/projects/fastmm/). Best regards, Marian |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store