Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

How to Generate a Grayscale TIFF image from color PDF (using Aspose.PDF)

$
0
0
Hi

I am converting a PDF document to TIFF image and while converting I want TIFF image to be a grayscale (or black & white). My PDF document has colors and TIFF is also coming with colors. How can I get a TIFF which is GrayScale? Below is my code. inputStream is a PDF document. 

MemoryStream outputStream = null;
          //Open document
                    Document pdfDocument = new Document(inputStream);
                    
                    

                    //Create Resolution object
                    Resolution resolution = new Resolution(300);
                    
                    //Create TiffSettings object
                    TiffSettings tiffSettings = new TiffSettings();
                    tiffSettings.Compression = CompressionType.LZW;
                    tiffSettings.Depth = ColorDepth.Format4bpp;
                    tiffSettings.Shape = ShapeType.Portait;
                    tiffSettings.SkipBlankPages = false;
                                      
                   
                    //Create TIFF device
                    TiffDevice tiffDevice = new TiffDevice(PageSize.PageLetter, resolution, tiffSettings);

                    outputStream = new MemoryStream();

 tiffDevice.Process(pdfDocument, 1, pdfDocument.Pages.Count, outputStream);


Any help is greatly appreciated.
Thanks
Piyush

Viewing all articles
Browse latest Browse all 3131

Trending Articles