Hi, is it possible to write one PdfAttachmentAnnotation link into Grid cellule ?
Thanks
PdfDocument pdf = new PdfDocument();
PdfPageBase page = pdf.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(3);
float x = 50;
float y = 100;
float width = 100;
float height = 20;
//Set the width
for (int j = 0; j < grid.Columns.Count; j++)
{
grid.Columns[j].Width = width;
}
//Add rows
PdfGridRow row0 = grid.Rows.Add();
PdfGridRow row1 = grid.Rows.Add();
//Set the height
for (int i = 0; i < grid.Rows.Count; i++)
{
grid.Rows[i].Height = height;
}
grid.Draw(page, new PointF(x, y));
x = x + width + 18;
y = y + 2;
byte[] data = File.ReadAllBytes("SalesReportChart.png");
PdfTrueTypeFont font2 = new PdfTrueTypeFont(new Font("Arial", 14f, FontStyle.Bold));
PointF location = new PointF(x, y);
String label = "Report";
SizeF size = font2.MeasureString(label);
RectangleF bounds = new RectangleF(location, size);
page.Canvas.DrawString(label, font2, PdfBrushes.DarkOrange, bounds);
bounds = new RectangleF(bounds.Right, bounds.Top, font2.Height, font2.Height);
//Create a PdfAttachmentAnnotation
PdfAttachmentAnnotation annotation1
= new PdfAttachmentAnnotation(bounds, "SalesReportChart.png", data);
annotation1.Color = Color.Teal;
annotation1.Flags = PdfAnnotationFlags.ReadOnly;
annotation1.Icon = PdfAttachmentIcon.Graph;
annotation1.Text = "Report";
//Add the annotation1
page.AnnotationsWidget.Add(annotation1);
pdf.SaveToFile("out.pdf");