Hello Everyone,
When I am trying to convert TIFF file of size 110 MB to PDF file, the ASPOSE library is throwing serialization error from calling desktop application. Its working perfect for small sized files. I have mentioned my code snippet in the below.
private static void ConvertTiffToPdf(string sourceFilePath, string targetFolderPath, string filename)
{
using (var fs = new FileStream(sourceFilePath, FileMode.Open, FileAccess.Read))
{
using (var image = Aspose.Imaging.Image.Load(fs))
{
//Obtain default saving options defined for each image
ImageOptionsBase exportOptions = new PdfOptions() { PdfCoreOptions = new Aspose.Imaging.FileFormats.Pdf.PdfCoreOptions() { Compression = PdfImageCompressionOptions.Ccitt4 }, UseOriginalImageResolution = true };
image.Save(targetFolderPath.TrimEnd('\\') + $"\\{filename}.pdf", exportOptions);
}
}
}
Could you please suggest the optimal way to convert such big tiff files(110 MB) to PDF?
Thank you.
Error: IndexOutOfRangeException: Index was outside the bounds of the array.
Option 2 code snippet:
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(sourceFilePath,new Aspose.Imaging.LoadOptions { BufferSizeHint= 10 }))
{
//Obtain default saving options defined for each image
ImageOptionsBase exportOptions = new PdfOptions() { PdfCoreOptions = new Aspose.Imaging.FileFormats.Pdf.PdfCoreOptions()
{ Compression = PdfImageCompressionOptions.Ccitt4 }, UseOriginalImageResolution = true };
@ajayu, please provide your source file.Also please note in p.2 you set extremely small buffer 10 Mb only, this way it will work but will take too long time, you can increase your buffer size for example to 500 or 1000 mb and check results.