We are trying to convert PDF to TIFF. If the PDF is just text and can be converted using CCITT4 compression the resulting TIFF is fine and easily read. However, if the PDF includes color images and text then the text in the resulting TIFF file cannot be easily read and the size of the file is large. I am using the following which is from another forum post.
//create PdfConverter object and bind input PDF file
Aspose.Pdf.Facades.PdfConverter pdfConverter = new Aspose.Pdf.Facades.PdfConverter();
// create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(SetSaveOptionResolution());
// specify the resolution value for PdfConverter object - default is 150
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf(cnvFileData.CnvFileName);
// start the conversion process
pdfConverter.DoConvert();
//create TiffSettings object, set Compression and ColorDepth
Aspose.Pdf.Devices.TiffSettings tiffSettings = new Aspose.Pdf.Devices.TiffSettings();
if (BlackAndWhite ||
CheckOverrideCompression(fileExt) ||
Compression.Equals("Group4FaxEncoding", StringComparison.CurrentCultureIgnoreCase))
tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.CCITT4;
else
tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.LZW;
retFileName = System.IO.Path.ChangeExtension(cnvFileData.CnvFileName, format.ToLower());
pdfConverter.SaveAsTIFF(retFileName, tiffSettings);
pdfConverter.Close();
//create PdfConverter object and bind input PDF file
Aspose.Pdf.Facades.PdfConverter pdfConverter = new Aspose.Pdf.Facades.PdfConverter();
// create Resolution object with 300 as an argument
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(SetSaveOptionResolution());
// specify the resolution value for PdfConverter object - default is 150
pdfConverter.Resolution = resolution;
// bind the source PDF file
pdfConverter.BindPdf(cnvFileData.CnvFileName);
// start the conversion process
pdfConverter.DoConvert();
//create TiffSettings object, set Compression and ColorDepth
Aspose.Pdf.Devices.TiffSettings tiffSettings = new Aspose.Pdf.Devices.TiffSettings();
if (BlackAndWhite ||
CheckOverrideCompression(fileExt) ||
Compression.Equals("Group4FaxEncoding", StringComparison.CurrentCultureIgnoreCase))
tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.CCITT4;
else
tiffSettings.Compression = Aspose.Pdf.Devices.CompressionType.LZW;
retFileName = System.IO.Path.ChangeExtension(cnvFileData.CnvFileName, format.ToLower());
pdfConverter.SaveAsTIFF(retFileName, tiffSettings);
pdfConverter.Close();
This is being done in a console app or service. Are there settings that will give better results for color both file size and legibility of text? Can we query attributes of the PDF in order to make better decision on the compression and resolution? For instance if the PDF is all text but saved as color can we determine that it is all text and can be saved as CCITT4.
File to be converted is attached.