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

Free Support Forum - aspose.com

Cut edges of TiFF images

I tried to use aspose pdf to convert some images to pdf , I have a problem that some TIFF images are converted to pdf but with some cut edges.

I testd this case using an exmple from you when installing a trail version

Could you help me to solve this problem, please.

Hi Hiba,


Thanks for using our API.

In order to resolve your problem, you may consider setting page dimensions (Width x Height) equal to input image dimensions. Please try using following code snippet.

[C#]

//
load source PDF file
<o:p></o:p>

Document doc = new Document();

// add page to PDF document

doc.Pages.Add();

// instantiate Image instance

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

// specify path for image file

image.File = "c:/pdftest/iPhone_5s.jpg";

// set left-top-bottom-right margin for first apge

doc.Pages[1].PageInfo.Margin.Left = 0;

doc.Pages[1].PageInfo.Margin.Top = 0;

doc.Pages[1].PageInfo.Margin.Bottom = 0;

doc.Pages[1].PageInfo.Margin.Right = 0;

// set page size equal to image dimensions

doc.Pages[1].SetPageSize(image.FixWidth, image.FixHeight);

// add image to paragraphs collection of page 1

doc.Pages[1].Paragraphs.Add(image);

// save PDF file

doc.Save("c:/pdftest/Image_to_Pdf.pdf");

Thanks it Works :smiley:

Hi Hiba,


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.