I am attempting to add an image to a table using the Aspose.Pdf namespaces and the process hangs on the call to Save(). I have seen how to do it using the Generator namespaces, but I would rather use the newer DOM based apis.
Here is the code:
var document = new Document();
var page = document.Pages.Add();
page.BleedBox = new Rectangle(9f, 711f + 9f, 468f + 9f, 0f);
page.TrimBox = new Rectangle(9f, 720f, 468f + 9f, 9f);
page.PageInfo.Height = 711f + 9f + 9f;
page.PageInfo.Width = 468f + 9f;
var table = new Table();
table.Left = 100;
table.Top = 100;
table.ColumnWidths = “100 100 100”;
table.Border = new BorderInfo(BorderSide.All, 1f, Color.DarkBlue);
for (var i = 0; i < 3; i++) {
var row = table.Rows.Add();
for (var j = 0; j < 3; j++) {
var cell = row.Cells.Add();
cell.BackgroundColor = Color.Yellow;
}
}
var image = new Image { File = @“C:\Users\Jonathan\Downloads\logos\3M.png”, FixWidth = 100 };
table.Rows[1].Cells[1].Paragraphs.Add(image);
page.Paragraphs.Add(table);
document.Save(@“C:\Users\Jonathan\Downloads\logos\learnAspose.pdf”);
I just recently purchased Aspose.Pdf and I am trying to wrap my mind around it.
Thanks,
Jon