When exporting a document that contains a Widget created with FixedContentEditor an exception is thrown: System.ArgumentNullException: 'Value cannot be null. Parameter name: context'
It can be reproduced using the following code snippet:
RadFixedDocument document = new RadFixedDocument();
var page = document.Pages.AddPage();
FixedContentEditor editor = new FixedContentEditor(page);
PushButtonField pushButton = new PushButtonField("button");
editor.Position.Translate(20, 450);
editor.DrawWidget(pushButton, new Size(100, 20));
string path = "Exported.pdf";
File.Delete(path);
using (Stream output = File.OpenWrite(path))
{
PdfFormatProvider provider = new PdfFormatProvider();
provider.Export(document, output);
}
document.AcroForm.FormFields.Add(pushButton);
When writing a RadFixedPage containing widgets using the PdfPageStreamWriter.WriteContent() method an exception is thrown.
The exception: System.ArgumentNullException: 'Value cannot be null. Parameter name: context'
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."
Such fonts are:
Cell borders are not set when the border is set on the table:
<table border="1">
Provide API or mechanism for reusing the already embedded fonts instead of creating a new one when editing an existing document.
This causes an issue in adobe preflight (font name is not unique).
The issue is observed when performing merge with RadFixedDocument as well.
Hidden fields with pushButton widget become visible when using FlattenFormFields method to flatten fields.
Workaround: do not flatten fields if the IsHidden property of any of its Widget's is set to True:
var fieldsList = formFields.ToList();
for (int i = 0; i < fieldsList.Count; i++)
{
var field = fieldsList[i];
bool flattenCurrentField = true;
if (field.FieldType == FormFieldType.PushButton)
{
PushButtonField pushButtonField = (PushButtonField)field;
PushButtonWidget[] widgets = pushButtonField.Widgets.ToArray();
foreach (var widget in widgets)
{
var baseType = typeof(PushButtonWidget).BaseType.BaseType.BaseType;
PropertyInfo[] properties = baseType.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance);
PropertyInfo isHidden = properties.FirstOrDefault(p => p.Name == "IsHidden");
bool value = (bool)isHidden.GetValue(widget);
if (value == true)
{
flattenCurrentField = false;
break;
}
}
}
if (flattenCurrentField)
{
document.AcroForm.FlattenFormField(field);
}
}
Allow table spiting to be done on whole rows instead of splitting the content of the rows.
Attached is a small project that shows a possible workaround.
The table border styles are not imported correctly with a specific document.
Workaropund:
RtfFormatProvider provider = new RtfFormatProvider();
RadFlowDocument document = provider.Import(File.ReadAllText(@"..\..\test.rtf"));
PdfFormatProvider pdfProvider = new PdfFormatProvider();
var tables = document.EnumerateChildrenOfType<Table>();
foreach (var table in tables)
{
table.Borders = new TableBorders(new Border(BorderStyle.None));
}
using (FileStream stream = File.OpenWrite(@"..\..\result.pdf"))
{
pdfProvider.Export(document, stream);
}