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;
A memory leak occurs in the RadTreeView control used for the table of contents in the RadPdfViewerNavigationPane, when changing the DocumentSource of RadPdfViewer at runtime.
To work this around, you can get the RadTreeView used by RadPdfViewerNavigationPane and manually clear its internal item storage before assigning the new DocumentSource.
private void ReloadDocument()
{
var navigationPane = this.pdfViewerNavigationPane;
var navigationPaneTreeView = navigationPane.FindChildByType<RadTreeView>();
if (navigationPaneTreeView != null)
{
object itemStorage = typeof(RadTreeView)
.GetProperty("ItemStorage", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(navigationPaneTreeView);
MethodInfo itemStorageClearMethod = itemStorage.GetType().GetMethod("Clear", BindingFlags.Instance | BindingFlags.NonPublic);
itemStorageClearMethod.Invoke(itemStorage, null);
}
this.DocumentSource = theNewDocumentSource;
}
Some lines on attached files are to thick. Other pdf programs shows that correctly.
Regards
Janez
The CurrentPageTextBox in the toolbar has stopped displaying in the latest version.
Workaround:
<telerik:CurrentPageTextBox x:Name="PART_CurrentPageNumberTextBox"
HorizontalContentAlignment="Center"
Margin="2" Text="{Binding FixedDocumentViewer.CurrentPageNumber, Mode=TwoWay}"
VerticalContentAlignment="Center" Width="45"
telerik:StyleManager.Theme="Office_Black"/>