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 - AddImageFromFile and multipage TIF
  FAQ FAQ  Forum Search   Register Register  Login Login

AddImageFromFile and multipage TIF

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


Joined: 23 Feb 07
Location: Germany
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote peteratoce Quote  Post ReplyReply Direct Link To This Post Topic: AddImageFromFile and multipage TIF
    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
Back to Top
ixm7 View Drop Down
Senior Member
Senior Member


Joined: 13 Jan 06
Status: Offline
Points: 68
Post Options Post Options   Thanks (0) Thanks(0)   Quote ixm7 Quote  Post ReplyReply Direct Link To This Post Posted: 24 Feb 07 at 1:12PM
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
Back to Top
peteratoce View Drop Down
Beginner
Beginner


Joined: 23 Feb 07
Location: Germany
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote peteratoce Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 07 at 3:53AM
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
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: 25 Feb 07 at 6:23AM
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
Back to Top
ixm7 View Drop Down
Senior Member
Senior Member


Joined: 13 Jan 06
Status: Offline
Points: 68
Post Options Post Options   Thanks (0) Thanks(0)   Quote ixm7 Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 07 at 7:38AM
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
Back to Top
peteratoce View Drop Down
Beginner
Beginner


Joined: 23 Feb 07
Location: Germany
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote peteratoce Quote  Post ReplyReply Direct Link To This Post Posted: 04 Mar 07 at 11:36AM
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
Back to Top
ixm7 View Drop Down
Senior Member
Senior Member


Joined: 13 Jan 06
Status: Offline
Points: 68
Post Options Post Options   Thanks (0) Thanks(0)   Quote ixm7 Quote  Post ReplyReply Direct Link To This Post Posted: 04 Mar 07 at 11:46AM
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
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: 04 Mar 07 at 2:08PM
"... 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

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: 04 Mar 07 at 2:19PM
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


Back to Top
peteratoce View Drop Down
Beginner
Beginner


Joined: 23 Feb 07
Location: Germany
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote peteratoce Quote  Post ReplyReply Direct Link To This Post Posted: 06 Mar 07 at 4:18AM
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  
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: 06 Mar 07 at 5:14AM
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
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: 11 Apr 07 at 10:51AM

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

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