Free Support Forum - aspose.com

Error while converting Tiff -> Pdf: invalid next size (fast). Using Aspose.Pdf, C#, Ubuntu

Hi,

I am converting a TIFF file to PDF using Aspose.PDF and I am getting an error.

Could you please tell me what might be causing this issue?

ОS: Ubuntu 18.04.3 LTS.
C# .net.
Project Target Framework: .NET Core 2.2.

I used the following code:

public static void TiffToPdf(string sourcePath, string targetPath)
{
  Console.WriteLine("Start convert Tiff To Pdf.");

  using (var inputStream = new MemoryStream())
  {
    using (var fileStream = File.Open(sourcePath, FileMode.Open, FileAccess.ReadWrite))
      fileStream.CopyTo(inputStream);
    var pdfDocument = new Aspose.Pdf.Document();
    var page = pdfDocument.Pages.Add();

    using (var img = System.Drawing.Image.FromStream(inputStream))
    {
      var image = new Aspose.Pdf.Image
      {
        ImageStream = inputStream,
        IsInNewPage = true,
        IsKeptWithNext = true,
        HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center,
      };

      page.Paragraphs.Add(image);
      Console.WriteLine("Before save.");
      pdfDocument.Save(targetPath);
      Console.WriteLine("Convert Tiff To Pdf is success.");
    }
  }
}

Error message:
Start convert Tiff to PDF.

Before save.
Free(): invalid next size (fast)
[1] 47173 abort (core dumped) dotnet CorePdfConverter.dll

The error occurs on the line:
pdfDocument.Save(targetPath);

The file I used:TIFF Шаблон устава проекта 3стр.zip (106.4 KB)

@directum

Could you please make sure that you are using Aspose.PDF for .NET 20.10 in your environment. In case issue still persists, please share complete stack trace information as well.

I tried the version 20.10 and got the same problem. Can you please instruct me on how to get the full stack trace? I tried the following code
catch(Exception ex)
{
Console.WriteLine(ex);
Console.WriteLine(ex.InnerException);
}
yet all I get is the short message I listed before.

@directum

We have tested the scenario in an environment i.e. CentOS 7 x64 and faced a different exception i.e. System.ldi not found. Hence, we have logged an issue as PDFNET-48909 in our issue tracking system for this case. We will further investigate it in details and keep you informed about its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.