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



Last Go to last post Unread Go to first unread post
#1 Posted : Friday, March 31, 2017 3:34:53 PM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 39

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)


For this we can leverage the RasterCodecs class. This class offers a number of overloads for loading and saving files.


The following code snippet demonstrates how the load and save method overloads would be use to create multipage TIFFs from PDF and individual TIFFs from PDF.

using (RasterCodecs codecs = new RasterCodecs())
    //load the original PDF
    codecs.Options.Load.AllPages = true;
    using(RasterImage image = codecs.Load(@"C:\Users\Public\Documents\LEADTOOLS Images\Leadtools.pdf"))
        //save as multipage tiff
        codecs.Save(image, @"output path.tif", RasterImageFormat.Tif, 0, 1, -1, 1, CodecsSavePageMode.Overwrite);

        //save each page as individual tiff
        for (int i = 1; i <= image.PageCount; i++)
            codecs.Save(image, @"output path" + i + ".tif", RasterImageFormat.Tif, 0, i, i, 1, CodecsSavePageMode.Overwrite);

Another option is to use the RasterImage Class to create multipage images in memory. The RasterImage object can hold multiple pages with different sizes. The AddPage, AddPages, InsertPage and InsertPages methods allows adding new pages to an existing RasterImage.

Edited by moderator Tuesday, March 20, 2018 4:36:59 PM(UTC)  | Reason: Updated links to v20 and reformatted code

Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.


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.

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-2018, Yet Another Forum.NET
This page was generated in 0.137 seconds.