var pageMarginsPropInfo = typeof(PagesLayoutManagerBase).GetField("pageMargins", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic);
pageMarginsPropInfo.SetValue(null, new Size(0, 0));
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;
Hello,
I use RadPdfViewer to view a PDF file in my WPF application, the PDF file has only one page and the contents are in the middle of the page, so I'm trying to zoom and focus on the middle of the page, I use the following code:
private void DocumentChanged(object sender, DocumentChangedEventArgs e)
{
pdfViewer.ScaleFactor = 1.3;
var size = pdfViewer.Document.Pages[0].Size;
pdfViewer.ScrollToVerticalOffset(size.Height * 0.3);
pdfViewer.ScrollToHorizontalOffset(size.Width * 0.20);
}
however, I only see the horizontal scroll working.
How can I zoom then scroll to vertical and horizontal offset?
From the PDF Specification: "An ink annotation represents a freehand “scribble” composed of one or more disjoint paths. When opened, it displays a pop-up window containing the text of the associated note."
Sometimes the Ink annotations are imported as UnsupportedAnnotation and not displayed as expected. In such cases, the annotations could be removed from the RadFixedPage content in the following manner:
foreach (RadFixedPage page in document.Pages)
{
List<Annotation> inkAnnotations = page.Annotations.Where(a => a.Type == AnnotationType.Ink).ToList();
foreach (Annotation inkAnnotation in inkAnnotations)
{
page.Annotations.Remove(inkAnnotation);
}
}
Handle import of documents containing Simple fonts with names of entries in the Encoding`s Differences that are not part of the Adobe Glyph List.
According to the PDF Specification (9.10.2 Mapping Character Codes to Unicode Values) if the name is not part of the list: If these methods fail to produce a Unicode value, there is no way to determine what the character code represents.
The object definitions are split into several lines:
According to the PDF specification (Adobe® Portable Document Format Version 1.7):
Append a rectangle to the current path as a complete subpath, with lower-left corner (x, y) and dimensions width and height in user space.
The operation:
x y width height re
An invalid case:
0 - 595 -842 re
This leads to an exception thrown: System.NullReferenceException: 'Object reference not set to an instance of an object.'