When importing a document containing Outlines (Bookmarks) containing Actions with an empty dictionary:
<</Title(Bookmarks)/Parent .../First .../Last .../Prev .../A<<>>/Count ...>
leads to an exception thrown: System.MissingMethodException: 'Cannot create an abstract class.'
From the PDF specification:
Prev: (Present only if the file has more than one cross-reference section; must not be an indirect reference) The byte offset from the beginning of the file to the beginning of the previous cross-reference section.
When importing such a document an exception is thrown: System.ArgumentNullException: 'Value cannot be null.
When extracting text from a composite font the ToUnicode mapping should be used but when this mapping is missing the char codes must be mapped by constructing a secondary map from fonts ordering and registry.
A possible workaround could be to register a TrueType font using the FontsRepository.RegisterFont() method:
FontsRepository.RegisterFont(new FontFamily(fontName), FontStyles.Normal, FontWeights.Normal, File.ReadAllBytes(pathToFont));
FontsRepository.TryCreateFont(new FontFamily(fontName), FontStyles.Normal, FontWeights.Normal, out FontBase font);
foreach (RadFixedPage page in document.Pages)
{
foreach (ContentElementBase contentElement in page.Content)
{
if (contentElement is TextFragment textFragment)
{
if (textFragment.Font.Name == fontName)
{
textFragment.Font = font;
}
}
}
}
When importing a PDF document, opening the stream in using statement, and using the default constructor of the PdfDocumentSource class, an exception is thrown:
using (Stream stream = ofd.OpenFile())
{
this.pdfViewer.DocumentSource = new PdfDocumentSource(stream);
}
using (Stream stream = ofd.OpenFile())
{
PdfImportSettings importSettings = new PdfImportSettings
{
CopyStream = true
};
this.pdfViewer.DocumentSource = new PdfDocumentSource(stream, importSettings);
}