Convert TIFF file to PDF using Aspose.PDF for .NET - problems with stamping

We purchased Aspose.Total for .NET yesterday. I’m using Aspose.Pdf to convert a tiff file to a pdf. The conversion seems to go OK and there are no exceptions but the tiff image which is 8.5 X 11 creates a PDF page that is about 8.5 X 11.75. The additional height is causing problems with stamping using Aspose.Pdf.Kit.

Is there a property that I can set to avoid the additional height?

Hi,

Thanks for your interest in Aspose.

You can use PageInfo property of Section class to specify the PageHeight and PageWidth. Please try using the following code snippet.

[C#]

Document doc = new Document();
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
System.Drawing.Image imgFromStream = new Bitmap(fs);
// Create a new Page in the Pdf document
Aspose.Pdf.Page currpage = doc.Pages.Add();
double pWidth = ((imgFromStream.Width / imgFromStream.HorizontalResolution) * 72);
double pHeight = ((imgFromStream.Height / imgFromStream.VerticalResolution) * 72);
// Set margins so image will fit, etc.
currpage.PageInfo.Margin.Top = 5;
currpage.PageInfo.Margin.Bottom = 5;
currpage.PageInfo.Margin.Left = 5;
currpage.PageInfo.Margin.Right = 5;
// Create an image object
Image image1 = new Aspose.Pdf.Image();
image1.File = filename;
image1.IsBlackWhite = false;
// Add the image into paragraphs collection of the page
currpage.Paragraphs.Add(image1);
fs.Close();

doc.Save(dataDir + "outputFromTifs.pdf");