Unplanned
Last Updated: 16 Oct 2023 09:38 by Dominik
Dominik
Created on: 16 Oct 2023 09:38
Category: PDFViewer
Type: Feature Request
1
PdfViewer: Provide a default appearance for fields that do not contain one.

Provide a default appearance for fields that do not contain one. 

Workaround: set border and background manually:

var provider = new PdfFormatProvider();
var document = provider.Import(File.ReadAllBytes(@"..\..\..\Systemvariablen.pdf"));

foreach (var item in document.AcroForm.FormFields)
{ 
    var widget = item.Widgets.First() as VariableContentWidget;
     
    if (widget != null)
    { 
        widget.AppearanceCharacteristics.Background = new RgbColor(255, 0, 0);
        widget.AppearanceCharacteristics.BorderColor = new RgbColor(0, 0, 255);
        widget.Border = new AnnotationBorder(2, AnnotationBorderStyle.Solid, null);
      
        widget.RecalculateContent(); 
    }
}

pdfViewer.Document = document;

0 comments