Click or drag to resize

PdfAnnotationDataConverterConvertAnnotationDataToPdf Method (LayerData, AnnotationUnit, Dpi, PdfGeneratedPage, GlobalResources, PdfUnknownAnnotationHandler)

Converts a page of annotations to PDF annotations.
Examples
In the following example, annotations are converted for use in the PdfGeneratedPage.
ConvertAnnotationsForPdfGeneratedPageExample
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 annotations =
        PdfAnnotationDataConverter.ConvertAnnotationDataToPdf(layer, AnnotationUnit.Pixel, dpi, page,
            doc.Resources);
    page.Annotations.AddRange(annotations);
}

doc.Save(pdfStream);

Namespace:  Atalasoft.dotImage.PdfDoc.Bridge.Annotate
Assembly:  Atalasoft.dotImage.PdfDoc.Bridge (in Atalasoft.dotImage.PdfDoc.Bridge.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public static List<BaseAnnotation> ConvertAnnotationDataToPdf(
	LayerData layer,
	AnnotationUnit units,
	Dpi resolution,
	PdfGeneratedPage pdfPage,
	GlobalResources resources,
	PdfUnknownAnnotationHandler handler = null
)

Parameters

layer
Type: Atalasoft.AnnotateLayerData
A page of annotations.
units
Type: Atalasoft.AnnotateAnnotationUnit
An units in which the page size are expressed.
resolution
Type: Atalasoft.ImagingDpi
A resolutions of the page.
pdfPage
Type: Atalasoft.PdfDoc.GeneratingPdfGeneratedPage
The target PDF page.
resources
Type: Atalasoft.PdfDoc.Generating.ResourceHandlingGlobalResources
Resources that are used by PDF annotations will be placed in this container.
handler (Optional)
Type: Atalasoft.Annotate.ExportersPdfUnknownAnnotationHandler
The handler for unknown annotation type.

Return Value

Type: ListBaseAnnotation
The list of PDF annotations.
See Also