LEADTOOLS Support
Imaging
Imaging SDK Questions
Document don´t decrease file size when deleting/replacing pages
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Tuesday, October 20, 2009 9:57:05 PM(UTC)
Groups: Registered
Posts: 7
I have a problem:
Some times I need to delete some page of a document and other times I need to replace a concrete page.
I need to do this directly from the file in the disk (not from memory).
I use the following methods:
rasterCodecs.DeletePage("Doc01.tif", pageIndex);
rasterCodecs.Save(image, "Doc01.tif", RasterImageFormat.TifLzw, 0, 1, 1, pageIndex, CodecsSavePageMode.Replace);
The problem is that when I use this methods the file size don't decrement, and if I have 5 pages and I delete 4 pages, the document still occupy the same as if it has 5 pages.
The same occurs if I have a document of 2 pages, I replace one page, and the document now occupy the same as before plus the size of the page I replace (now occupy like if it has 3 pages).
What are wrong with that methods? or with my code?
I am using LeadTools (version info 16.5.0.11).
#2
Posted
:
Wednesday, October 21, 2009 4:40:59 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The CodecsSavePageMode.Replace option will flag the page as deleted without actually deleting it. If you want to replace the entire file, you can use the CodecsSavePageMode.Overwrite option or just use the RasterCodecs.CompactFile Method to compact and clean the file from the deleted pages.
#3
Posted
:
Thursday, October 22, 2009 10:19:32 PM(UTC)
Groups: Registered
Posts: 7
Thanks, now works correctly!
LEADTOOLS Support
Imaging
Imaging SDK Questions
Document don´t decrease file size when deleting/replacing pages
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.