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

Free Support Forum - aspose.com

Setting border when converting image to pdf

How to add border to image when converting an image to pdf without affecting image quality ?

Hi Thomas,

Thanks for your inquiry. You may create a table with border and add image to it. Please check following sample code snippet. Hopefully it will help you to accomplish the task.

string outFile = myDir + “Imageoutput.pdf”;<o:p></o:p>

string inFile = myDir + "SampleImage.jpg";

Document doc = new Document();

Page page = doc.Pages.Add();

//Create an image object

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

image.File = inFile;

var tableimage = new Aspose.Pdf.Table();

//Set default cell border using BorderInfo object

tableimage.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.Box, 1F);

tableimage.ColumnWidths = "100%";

var rowimage = tableimage.Rows.Add();

var cellimage = rowimage.Cells.Add();




Please feel free to contact us for any further assistance.

Best Regards,