We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create TIFF Images from PDF by Splitting PDF Pages in C#

Hi Team,
When we try to split a small sized pdf into individual tiffs we are getting large sized individual tiffs.
The compression we have given is LZW as we require Colour images.Do we have any properties which can reduce the image size as the image size is very huge when we compared to the pdf
Aspose Version is 19.5

The code we have implemented is
Resolution is 300,Brightness:0.33 and Compression is LZW

using (Aspose.Pdf.Document PdfDocument = new Aspose.Pdf.Document(Attatchment))
{
var resolution = new Resolution(Convert.ToInt32(Config.GetInstance()._resolution)); //put in config
var tiffSettings = new TiffSettings //put in config
{
Compression = Config.GetInstance()._compressionType,//LZW
Shape = ShapeType.None,
SkipBlankPages = false,
Brightness = float.Parse(Config.GetInstance()._brightness,–0.33
CultureInfo.InvariantCulture.NumberFormat)

                    };

                    _app.LogMsg("PDF Conversion Settings");
                    var tiffDevice = new TiffDevice(resolution, tiffSettings);
                    _app.LogMsg("TiffDevice");

                    if (PdfDocument.Pages.Count > 0)
                    {
                        pgCount += PdfDocument.Pages.Count;
                        for (; pg <= pgCount; pg++)
                        {
                            var saveName = Path.Combine(ItemTargetFolder, string.Format("{0}_{1}_{2}_{3}.{4}", Path.GetFileNameWithoutExtension(Attatchment), Path.GetExtension(Attatchment).Replace(".", ""), "Page", pg.ToString(), "tif"));
                            _app.LogMsg("saveName" + saveName);
                            if (File.Exists(saveName))
                            {
                                File.Delete(saveName);
                            }
                            _app.LogMsg("Tiff Device Start");
                            tiffDevice.Process(PdfDocument, pg, pg, saveName);
                            _app.LogMsg("Tiff Device End");
                            imageList.Add(Path.GetFileName(saveName));
                        }
                        _app.LogMsg("PDF Conversion Finished");
                    }

                    else
                    {
                        throw new Exception("The PDF file have no pages");
                    }
                }

@sreenath2020

Could you please share your sample PDF document for our reference? We will test the scenario in our environment by converting PDF to TIFF and address the issue accordingly.