PdfAnnotationDataConverterConvertAnnotationDataToPdf Method (LayerData, AnnotationUnit, Dpi, RectangleF, PdfPageRotation, GlobalResources, PdfUnknownAnnotationHandler) |
var rectData = new RectangleData() { Size = new SizeF(123, 345), Location = new PointF(123, 321), Fill = new AnnotationBrush(Color.FromArgb(255, 64, 128, 255)), Outline = new AnnotationPen(Color.FromArgb(255, 128, 128, 128)) }; var polyData = new PolygonData() { Size = new SizeF(100, 200), Location = new PointF(10, 11), Fill = new AnnotationBrush(Color.FromArgb(255, 64, 128, 255)), Outline = new AnnotationPen(Color.FromArgb(255, 128, 128, 128)) }; polyData.Points.AddRange(new[] { new PointF(1, 1), new PointF(50, 50), new PointF(1, 50) }); var layer = new LayerData() { Items = { rectData, polyData } }; var dpi = new Dpi(96, 96, ResolutionUnit.DotsPerInch); var doc = new PdfGeneratedDocument(source); var page = doc.Pages[0] as PdfGeneratedPage; if (page != null) { var cropBox = page.CropBox.IsEmpty() ? page.MediaBox.ToRectangleF() : page.CropBox.ToRectangleF(); var rotation = page.Rotation; var annotations = PdfAnnotationDataConverter.ConvertAnnotationDataToPdf(layer, AnnotationUnit.Pixel, dpi, cropBox, rotation, doc.Resources); page.Annotations.AddRange(annotations); } doc.Save(pdfStream);
Namespace: Atalasoft.dotImage.PdfDoc.Bridge.Annotate
public static List<BaseAnnotation> ConvertAnnotationDataToPdf( LayerData layer, AnnotationUnit units, Dpi resolution, RectangleF pdfPageBox, PdfPageRotation rotation, GlobalResources resources, PdfUnknownAnnotationHandler handler = null )