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

Free Support Forum - aspose.com

Convert TIFF Imageto PDF

Hello,

I am converting TIFF images to PDF files and resulting PDF is always smaller than the TIFF image. The PDF is not a full page; it has large page margins on all four sides.

How do I set the PDF margins so the image covers a full page as the original image does?

I have attached a TIFF and the resulting PDF file for reference.

Regards,

Dan Ludwig

Deloitte Tax LLP

Hi Dan,

Thanks for using our products.

You can set the custom position of an image by setting the PositioningType property to PageRelative, but Aspose does not recommed to use custom positioning.

Please feel free to contact support in case you required any further assistance.

Thanks & Regards,

Hello Dan,


Thanks for using our products and contacting support.

Adding more to Rashid's comments, please note that in order for a TIFF image to cover the complete page, you need to set the Width and Height properties of Image equal to the page Width and Height information. More along in order to reduce the margin on all four sides of the page, please explicitly set the margin information for Section object. Please take a look over the following code snippet to accomplish this requirement. For your reference, I have also attached the resultant PDF that I have generated using Aspose.Pdf for .NET 6.7.0.

[C#]

//Instantiate a Pdf object by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf object
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
// set the margin information for section object
sec1.PageInfo.Margin.Left = sec1.PageInfo.Margin.Right = sec1.PageInfo.Margin.Top = sec1.PageInfo.Margin.Bottom = 5;
//Create an image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
//Add image object into the Paragraphs collection of the section
sec1.Paragraphs.Add(image1);
//Set the path of image file
image1.ImageInfo.File = "D:\\pdftest\\Temp\\Temp.tif";
//Set the type of image using ImageFileType enumeration
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
//Set the number of frames that need to be rendered in pdf file
image1.ImageInfo.TiffFrame = -1;
// set the width of image equal to page width
image1.FixedWidth = sec1.PageInfo.PageWidth;
// set the Height of image equal to page Height
image1.FixedHeight = sec1.PageInfo.PageHeight;
//Save the Pdf
pdf1.Save("D:\\pdftest\\Temp\\Temp-output.pdf");