Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, December 19, 2011 12:58:21 AM(UTC)
ghostmaster

Groups: Registered
Posts: 3


Hello, i've just bougth the Document Imaging Suite and i wondered how could i split and merge pdf files.

Thank you in advice,
Stefano
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, December 19, 2011 5:22:36 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

If you are wishing to maintain the PDF documents as searchable PDFs you would need to also acquire the LEADTOOLS PDF and Document Readers SDK.

http://www.leadtools.com/sdk/pdf/pdf-reader.htm

With this add-on you can use the PDFFile class to handle all of these operations. Specifically with the methods MergeWith, ExtractPages, and InsertPagesFrom

http://www.leadtools.com/help/leadtools/v175/dh/pdf/leadtools.pdf~leadtools.pdf.pdffile~mergewith.html

http://www.leadtools.com/help/leadtools/v175/dh/pdf/leadtools.pdf~leadtools.pdf.pdffile~insertpagesfrom.html

http://www.leadtools.com/help/leadtools/v175/dh/pdf/leadtools.pdf~leadtools.pdf.pdffile~extractpages.html

Without the add-on you already have access to load the PDFs as Rasterized documents which are not searchable. You can do these sort of operations with our standard page manipulation methods that you would use just as though it were a tiff file. These methods are displayed in the following link.

http://www.leadtools.com/help/leadtools/v175/dh/l/leadtools~leadtools.rasterimage~page.html

Here is also a tutorial for splitting a tiff file( the same code you would use with a raster PDF split ).

http://www.leadtools.com/help/leadtools/v175/dh/to/leadtools.topics~leadtools.topics.splittingamultipagetifffiletutorial.html
 
#3 Posted : Tuesday, December 20, 2011 12:19:16 AM(UTC)
ghostmaster

Groups: Registered
Posts: 3


Thank you for the answer. I've tried to split a pdf file with the second method but i got only black pages. Where is/are the error/s?

 Leadtools.Codecs.CodecsImageInfo info = _codecs.GetInformation(inputFileName1, true);
            // Inizio elaborazione
            _codecs.Options.Load.Format = RasterImageFormat.RasPdfLzw;                        
            Leadtools.RasterImage bcImageResto = _codecs.Load(
                inputFileName1,
                0, Leadtools.Codecs.CodecsLoadByteOrder.RgbOrGray,
                2, info.TotalPages);

            _codecs.Save(bcImageResto, inputFileNameResto1, RasterImageFormat.RasPdfLzw, 0,
                   1, info.TotalPages, 1, Leadtools.Codecs.CodecsSavePageMode.Overwrite);

Thank you in advice,
Stefano
 
#4 Posted : Tuesday, December 20, 2011 11:39:36 AM(UTC)

Danny H  
Guest

Groups: Guests
Posts: 3,028

Was thanked: 2 time(s) in 2 post(s)

You should be getting an invalid argument exception as you are blowing out of index on the image. Depending, you may also be getting Feature not Supported exceptions thrown.

Check your IDE for debug settings that may ignore these errors. Also, check your Codecs.ThrowExceptionsOnInvalidImages property.

To resolve your error you first need to specify 1 instead of 2 as the first page on your load call. Of course you can load the second page to the end, but you will need to understand the image your saving does not have the same number of pages as the original so the ImageInfo object is not valid for your save. bcImageRest.PageCount would be more appropriate if you're going to save less than the full image. Which you should since you're splitting them.

As far as another potential issue is the absense of Leadtools.Codecs.Tif.dll and Leadtools.Codecs.Fax.dll. These two dlls are required by the Lzw compression.

I would suggest commenting out _codecs.Options.Load.Format = RasterImageFormat.RasPdfLzw though, as that is not even a support read format. Yes, we're accepting it but not as a RasPdfLzw, but a standard RasPdf instead. All PDFs loaded by RasterCodecs will always use RasPdf regardless of compression or any other settings they may have.

Aside from these couple things it seems to be fine.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2020, Yet Another Forum.NET
This page was generated in 0.315 seconds.