Hi,
I try to convert Tiff to Pdf like this:
using (var imageStream = File.OpenRead(inputFile))
using (var image = Aspose.Imaging.Image.Load(imageStream))
using (var document = new Aspose.Pdf.Document())
{
var page = document.Pages.Add();
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;
page.PageInfo.Width = image.Width;
page.PageInfo.Height = image.Height;
page.CropBox = new Aspose.Pdf.Rectangle(0, 0, image.Width, image.Height);
var pdfImage = new Aspose.Pdf.Image();
pdfImage.ImageStream = imageStream;
page.Paragraphs.Add(pdfImage);
document.Save(outputFile);
}
and get error:
Unhandled Exception: System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.get_PropertyIdList()
at Aspose.Pdf.Image.#=z6kYfUaA=(Double& #=zlXeKPFM=, Double& #=zEIOZhh4=, Double& #=zR1bzaHA=, Boolean #=zilRKKGdKogIa, MarginInfo #=zLbrFmc0=, Double #=zw7uIEcGvyUsX, Double #=zD2Bz1s8=, Page #=z97RnNUE=, List`1 #=zsLUpgps=, Boolean #=zHO$s$gZYlaL1, Boolean #=zDlgDC8mw1nUm, Boolean #=zWlxW3i8=, Paragraphs& #=zCd2vwYcIrYQh2Pcsjw==, Double #=zwn6IXVSdfrBKCr4Ldg==, Double #=zmH4W35I=, Int32 #=z_V8J3X4ZTOXtTj125LlQog4=)
at #=z11tnCvcTNPOy$FsoWXXzdDw=.#=z6kYfUaA=()
at Aspose.Pdf.Page.#=zB99WyEE=(Page #=z97RnNUE=)
at Aspose.Pdf.Page.#=zMmMgvSVnYTOkxEqULQ==()
at Aspose.Pdf.Document.ProcessParagraphs()
at Aspose.Pdf.Document.#=zIgncJc8VsF3C(Stream #=zYpgNQcg=, SaveOptions #=zoR0TS01IZW9D)
at Aspose.Pdf.Document.#=zp0nLFuDb7z1v(String #=zQHkKAjLXFS_l)
at Aspose.Pdf.Document.Save(String outputFileName)
at ConsoleApp15.Program.ConvertInternal(String inputFile, String outputFile) in C:\Users\saragulov_nr\source\repos\ConsoleApp15\ConsoleApp15\Program.cs:line 42
at ConsoleApp15.Program.Main(String[] args) in C:\Users\saragulov_nr\source\repos\ConsoleApp15\ConsoleApp15\Program.cs:line 12
Aborted (core dumped)
This happends only on Ubuntu. On Windows, it works without errors. File: tiff.7z (1.0 MB)