LEADTOOLS Support
Document
Document SDK Questions
"Cannot insert, delete, append or replace pages" error.
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, November 1, 2006 2:44:16 PM(UTC)
Groups: Registered
Posts: 5
Hello,
I am having the "Cannot insert, delete, append or replace pages" error sporadically when saving a PDF file. My application is an ASP.NET application which converts multipage TIFF documents to PDF files. The error doesn't seem to have to do with the TIFF file itself. I can try and convert the same TIFF file ten times with the same exact code and nine times it will work and one time it will fail. The error seems to occur totally randomly.
Due to the fact that some pages within a few of the TIFF files on our system are corrupt, I have to read the TIFF files in one page at a time and then output them to the pdf file one page at a time. If I run into a corrupt page in the TIFF file, then I just skip that page in the PDF output.
My code (roughly) looks like:
String myTIFFFile = @"c:\color.tif";
String myPDFFile = @"c:\color.pdf";
LeadTools.Codecs.RasterCodecs.CodecsPath = @"C:\LEADTOOLS_CODECS\";
RasterCodecs codecs = new RasterCodecs();
int totalPages = codecs.GetInformation(myTIFFFile, true).TotalPages;
for(int i=1; i <= totalPages; i++) {
IRasterImage tiffPage = codecs.Load(myTIFFFile, 0, CodecsLoadByteOrder.Rgb, i, i);
codecs.Save( tiffPage, myPDFFile, RasterImageFormat.RasPdfJpeg422, 24, 1, 1, i, CodecsSavePageMode.Append );
}
This is causing a big problem and I have no ideas where to look. Any suggestions?
Thanks,
Jeff Smith
System Support Analyst
City of Henderson
#2
Posted
:
Thursday, November 2, 2006 12:07:47 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
Since the problem doesn't happen always, it might be related to the conditions when the function is called. For example, the file might be locked by a different process during saving, or maybe a different instance of the same process.
Does it always happen on a specific page (such as first or last page)?
Can you narrow down any of the circumstances that cause it?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#3
Posted
:
Thursday, November 2, 2006 8:29:08 AM(UTC)
Groups: Registered
Posts: 5
Hi Maen,
My first thought was just what you said, that some other process was locking the file or something along those lines. I don't believe that is the case though, I use a unique file name (basically a guid) which I output the PDF to and then rename to the final file name right at the end. Leadtools is erroring during the save to the unique file name, so I know my own process is not using that file, since nobody else would know the file name. I have also disabled anti-virus to make sure that anti-virus isn't grabbing and locking the file for a scan. I have also monitored the file system with sysinternals' filemon tool and I can see no other process that is attempting to access the file when it errors.
I see no common thread to the errors. The page numbers it occurs on are totally random. I have had an easier time generating the error lately though. I can usually generate it within about 5-10 requests now. I notice the larger the file I am converting, the more likely the problem is to occur.
Any other suggestions?
Thanks,
Jeff
#4
Posted
:
Thursday, November 2, 2006 2:53:51 PM(UTC)
Groups: Registered
Posts: 5
I reworked some of the code to try loading the entire TIFF file at once and then converting the whole thing to PDF in one fail swoop and it sometimes works and sometimes doesn't, it's totally random, but I get a different error. I get a "Leadtools error: -824" when running the codecs.Save function.
I looked up the -824 error and someone on the forum said that error indicates ERROR_JB2_FILTER_MISSING. I have checked and the Leadtools.Codecs.Jb2.dll file does definitely exist in my codec path. Plus, if that was the problem, I would think it would happen every time.
I can't help but think these two errors are related. Does this help at all?
Thanks,
Jeff
#5
Posted
:
Saturday, November 4, 2006 11:28:12 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
Please send me a sample TIFF image that shows the problem, so that I can check this issue on my side.
If you want to send files, you can either post them here or email them to support@LEADTOOLS.com)
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#6
Posted
:
Monday, November 6, 2006 9:03:47 AM(UTC)
Groups: Registered
Posts: 5
Hi Maen,
I have uploaded a TIFF image that will cause both the errors described in this thread, sporadically. Sometimes it converts fine, sometimes it errors. Due to the size of the TIFF (27mb), I uploaded to the LeadTools FTP site. The file is "/CityOfHenderson/errorConvertingToPDF.tif".
Thanks,
Jeff Smith
System Support Analyst
City of Henderson, NV
#7
Posted
:
Monday, November 6, 2006 10:06:39 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
Hello,
I am attaching a small project that converts TIFF file to PDF.
Please recheck the same issue using the attached project.
Also, what is the build number of the LEADTOOLS .Net DLLs that you use?
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#8
Posted
:
Tuesday, November 7, 2006 12:12:11 PM(UTC)
Groups: Registered
Posts: 5
I tried using your attached project and I was unable to get the same error that I am receiving.
The LEADTOOLS .Net DLLs version is 14.5.0.13.
-Jeff
#9
Posted
:
Tuesday, November 7, 2006 8:17:41 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
What is the exact version that you use (the evaluation or the full product version)?
If you are using the full product version, please download the latest patches from LEADTOOLS support site http://support.leadtools.com as follows:
1. You have to login our support site: http://support.leadtools.com.
If you are not a registered user, you need to register your email, and then login the support site.
2. After login, select "My Profile" tab and click "Add product registration" link.
3. Now, in the "Add a product registration" page insert your product serial#, and register your product.
4. After login, download the latest LEADTOOLS win32 patch from the "SDK Patches" tab.
Important Notes:
1. After login and registration, if you can't see the "SDK Patches" tab, try to refresh the page. If the problem persists, then please send an email to our sales department at sales@leadtools.com.
2. If you are using LEADTOOLS v14.5, you need to install the latest setup before installing the latest patch. So please send me your product serial number to send you the download and install instructions for the LEADTOOLS V14.5 setup.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
LEADTOOLS Support
Document
Document SDK Questions
"Cannot insert, delete, append or replace pages" error.
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.