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

Free Support Forum - aspose.com

Bug?Convert TIFF Image to Pdf the FixWidth FixHeight work only the one Frame!

Hi, I user Aspose.Pdf to convert the Tiff image to the pdf doc,and assign the FixWidth and FixHeight make it can fit to the Page width and height, but i find it work only the first Page find, the other page not work, the code :


Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
sec1.PageInfo.PageWidth = 800;
sec1.PageInfo.Margin.Bottom = 5;
sec1.PageInfo.Margin.Top = 4;
sec1.PageInfo.Margin.Left = 4;
sec1.PageInfo.Margin.Right = 4;
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image();
image1.ImageInfo.File = TemSourceFilePath;
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
image1.ImageInfo.TiffFrame = -1;
image1.ImageInfo.FixWidth = 800;
image1.ImageInfo.FixHeight = sec1.PageInfo.PageHeight;
sec1.Paragraphs.Add(image1);
pdf1.Save(@“c:\test.pdf”);
image1 = null;
sec1 = null;
pdf1 = null;

Can you help me? thank you!


Some one can help me? thanks a lot!

Hi,


Thanks for contacting support.
As per my observations, you are using legacy Aspose.Pdf.Generator approach to convert TIFF images to PDF format and we recommend using new Document Object Model of Aspose.Pdf namespace, so during my testing with following code snippet where I have used one of my sample TIFF images, I am unable to notice any issue. Can you please try using latest release and in case the problem still persists, please share the resource file. We are sorry for this inconvenience.

[C#]

Aspose.Pdf.Document pdf1 = new Aspose.Pdf.Document();<o:p></o:p>

Aspose.Pdf.Page sec1 = pdf1.Pages.Add();

sec1.PageInfo.Width = 800;

sec1.PageInfo.Margin.Bottom = 5;

sec1.PageInfo.Margin.Top = 4;

sec1.PageInfo.Margin.Left = 4;

sec1.PageInfo.Margin.Right = 4;

Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

image1.File = "c:/pdftest/57636652.TIF";

image1.FixWidth = 800;

image1.FixHeight = sec1.PageInfo.Height;

sec1.Paragraphs.Add(image1);

pdf1.Save(@"c:\pdftest\TIFF_To_PDFtest.pdf");

After code testing, that can work, perfect.

It is a good solution to my problem, thank you !

Hi,


Thanks for the acknowledgement. We are glad to hear that your problem is resolved. Please continue using our API’s and in the event of any further query, please feel free to contact.