IOException when an object in the cross-reference stream has a negative offset.
"System.IO.IOException: An attempt was made to move the file pointer before the beginning of the file."
When the last element in a table cell is an empty paragraph, the latter is skipped and not imported. It should be imported even if it's the only paragraph in the cell, as its properties could affect the layout and presentation (borders, colors, spacings).
Trying to clone the Signature of a SignatureField leads to InvalidOperationException as the FieldName of the cloned signature is already set.
Workaround: Remove the signatures before the merging of the document:
private static void RemoveSignatures(RadFixedDocument document)
{
List<FormField> signatures = document.AcroForm.FormFields.Where(ff => ff.FieldType == FormFieldType.Signature).ToList();
if (signatures.Count > 0)
{
foreach (FormField signature in signatures)
{
document.AcroForm.FormFields.Remove(signature);
}
}
List<SignatureWidget> signatureWidgets = document.Annotations.Where(a => a.Type == AnnotationType.Widget && a.GetType() == typeof(SignatureWidget)).Cast<SignatureWidget>().ToList();
if (signatureWidgets.Count > 0)
{
foreach (var signatureWidget in signatureWidgets)
{
foreach (RadFixedPage page in document.Pages)
{
if (page.Annotations.Contains(signatureWidget))
{
page.Annotations.Remove(signatureWidget);
}
}
}
}
}
When the document is encoded in two-byte encoding using Little-Endian, the CsQuery HTML parser provides the entire document as FirstChild of the <body> tag, which leads to incorrect import. This seems to be occurring with MS Outlook messages saved as HTML. Workaround: convert the file to Big-Endian encoding before importing.
Using a RadFlowDocumentEditor to add a page break and then insert a table, adds an additional paragraph in between.
As a workaround you can call the CleanParagraphsBeforeTablesOnNewPage() method:
private void CleanParagraphsBeforeTablesOnNewPage()
{
List<Paragraph> paragraphs = this.flowDocument.EnumerateChildrenOfType<Paragraph>().ToList();
foreach (var paragraph in paragraphs)
{
BlockContainerBase parent = (BlockContainerBase)paragraph.Parent;
int paragraphIndex = parent.Blocks.IndexOf(paragraph);
int blocksCount = parent.Blocks.Count;
bool isAfterPageBreak = paragraphIndex > 0 && this.PreviousBlockEndsWithPageBreak(parent.Blocks[paragraphIndex - 1]);
int nextIndex = paragraphIndex + 1;
bool nextBlockIsTable = nextIndex < blocksCount && parent.Blocks[nextIndex] is Table;
if (isAfterPageBreak && nextBlockIsTable)
{
parent.Blocks.Remove(paragraph);
}
}
}
private bool PreviousBlockEndsWithPageBreak(BlockBase blockBase)
{
bool isLastInlinePageBreak = false;
bool isParagraph = blockBase is Paragraph;
if (isParagraph)
{
Paragraph paragraph = (Paragraph)blockBase;
InlineBase lastInline = paragraph.Inlines.Last();
bool isBreak = lastInline is Break;
if (isBreak)
{
isLastInlinePageBreak = ((Break)lastInline).BreakType == BreakType.PageBreak;
}
}
return isLastInlinePageBreak;
}
Wrong encoding is used when the PDF file contains font with custom encoding
Workaround:
foreach (var widget in field.Widgets)
{
widget.TextProperties.Font = FontsRepository.Helvetica;
}
The image in the header is not exported to pdf.
Workaround: Use version R1 2022 where this is working.