VintaSoft PDF .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions
_annotationDataController = AnnotationDataController(_documentViewer.Images); // _documentViewer is Vintasoft.Imaging.UI.ImageViewer
AnnotatedPdfPrintDocument printManager = new AnnotatedPdfPrintDocument();
PdfAnnotationList annotations = null;
for (int i = 0; i < _annotationDataController.Images.Count; i++)
{
PdfPage page = PdfDocumentController.GetPageAssociatedWithImage(_annotationDataController.Images[i]);
annotations = page?.Annotations;
foreach (PdfAnnotation annotation in annotations)
{
annotation.IsPrintable = false;
annotation.Flags &= PdfAnnotationFlags.Print ^ (PdfAnnotationFlags)int.MaxValue;
}
}
printManager.AnnotationDataController = _annotationDataController;
/// <summary>
/// Begins the image printing and allows to initialize the printing settings.
/// </summary>
/// <param name="image">Image to print.</param>
/// <param name="renderingSettings">Image rendering settings.</param>
protected override void BeginPrintImage(Vintasoft.Imaging.VintasoftImage image, Vintasoft.Imaging.Codecs.Decoders.RenderingSettings renderingSettings)
{
// get PDF page associated with printing image
Vintasoft.Imaging.Pdf.Tree.PdfPage page =
Vintasoft.Imaging.Pdf.PdfDocumentController.GetPageAssociatedWithImage(image);
// if PDF page exists
if (page != null)
{
// create new PDF rendering settings
Vintasoft.Imaging.Codecs.Decoders.PdfRenderingSettings pdfRenderingSettings =
new Vintasoft.Imaging.Codecs.Decoders.PdfRenderingSettings();
// copy current rendering settings into new PDF rendering settings
renderingSettings.CopyTo(pdfRenderingSettings);
// disable rendering of annotations with disabled flags 'Invisible', 'Hidden', 'Print' and 'NoView'
pdfRenderingSettings.AnnotationRenderingMode &=
Vintasoft.Imaging.Pdf.PdfAnnotationRenderingMode.RenderDisplayable ^ (Vintasoft.Imaging.Pdf.PdfAnnotationRenderingMode)int.MaxValue;
// set new PDF rendering settings as current rendering settings
renderingSettings = pdfRenderingSettings;
}
base.BeginPrintImage(image, renderingSettings);
}