Currently this exception crashes the whole PDF document import. Instead we should simply skip the unsupported Action and import the rest of the PDF content correctly.
The hierarchical document structure is a means to describe the PDF document structure, which is currently not supported. See 10.6.1 Structure Hierarchy on 856 page of the PDF specification for details. This document structure is an alternative to the standard PDF structure and most non-Adobe software does not support it. The document might have been created with Adobe software like Adobe LiveCycle Designer. Very often the document contains some fallback text in the standard PDF structure like: "Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document." "The document you are trying to load requires Adobe Reader 8 or higher. You may not have the Adobe Reader installed or your viewing environment may not be properly configured to use Adobe Reader. For information on how to install Adobe Reader and configure your viewing environment please see http://www.adobe.com/go/pdf_forms_configure." "For the best experience, open this PDF portfolio in Acrobat X, Reader X, or later."
Although Lab color space is currently unsupported, the provider should not throw exceptions that break the whole file import.
For instance, we may implement WritePageAsync method in addition to the existing WritePage method. This is a similar scenario as in System.IO.StreamWriter class which has WriteLine and WriteLineAsync methods.
When a TrueType font is defined, the mapping of character codes to glyph indices depends on the built-in cmap table mappings defined in the font and the Encoding property defined in the PDF dictionary.
However, the current implementation maps all characters with cmap tables for Microsoft Symbolic and Macintosh Roman, which causes incorrect mapping results, e.g. space characters are mapped to an Ê glyph.
The issue is also described in the following public item: TryGetCharCode for OpenTypeFont uses wrong cmap and returns wrong charcode.
Workaround: Change the font of the TextBoxField's widget appearance:
foreach (var widget in field.Widgets)
{
widget.TextProperties.Font = FontsRepository.Helvetica;
}
Implement Replace method(s) which enable the users to replace a concrete string/content/text in a PDF document (RadFixedDocument).
When importing a not embedded TrueType Font defined as Type 1 subtype Font an InvalidCastException is thrown.
In PDF document:
<< /BaseFont /Arial /Encoding 21 0 R /Name /F13 /Subtype /Type1 /Type /Font >>
In Adobe Reader:
Support for exporting WMF (Windows Metafile) and EMF (Enhanced Metafile) images should be implemented for the Net Standard version.
To allow the library to export such images you can use the extensibility point for providing a custom implementation of the JpegImageConverterBase. More information and examples can be found in the PdfProcessing`s Cross-Platform Support help and Create Custom JpegImageConverter in .Net Standard knowledge base articles.
This could be implemented by linking to RadFixedPages or Bookmarks.
Until this feature is developed this could be custom created with the help of Link annotations:
RadFixedPage toc = new RadFixedPage();
document1.Pages.Insert(0, toc);
FixedContentEditor editor = new FixedContentEditor(toc);
foreach (RadFixedPage page in document1.Pages)
{
int pageNumber = document1.Pages.IndexOf(page);
if (pageNumber > 0)
{
int factor = 20;
int offsetX = 70;
int offsetY = 20 + factor * pageNumber;
editor.Position.Translate(offsetX, offsetY);
Block block = new Block();
block.GraphicProperties.FillColor = new RgbColor(255, 5, 99, 193);
block.InsertText($"Page {pageNumber}");
Size blockSize = block.Measure();
editor.DrawBlock(block);
Location location = new Location
{
Left = 0,
Top = 0,
Zoom = 0,
Page = page
};
GoToAction goToAction = new GoToAction();
goToAction.Destination = location;
Link uriLink = toc.Annotations.AddLink(goToAction);
uriLink.Rect = new Rect(offsetX, offsetY, blockSize.Width, blockSize.Height);
}
}
byte[] data = File.ReadAllBytes("verdana.ttf");
FontFamily verdanaRegularFontFamily = new FontFamily("Verdana");
FontsRepository.RegisterFont(verdanaRegularFontFamily, FontStyles.Normal, FontWeights.Normal, data);
FontsRepository.TryCreateFont(verdanaRegularFontFamily, out FontBase verdanaRegularFont);
foreach (RadFixedPage page in mergedDocument.Pages)
{
foreach (TextFragment textFragment in page.Content.Where(c => c is TextFragment).Cast<TextFragment>())
{
textFragment.Font = verdanaRegularFont;
}
}
The "g" and "G" operators are used for setting color with a single component. Available in R1 2017 Release
The public API may be implemented as property of PdfExportSettings. Implementing this feature would help to easily workaround issue with PdfProcessing documents that cannot be opened on devices with iOS version 10.2 (due to the default FlateDecode compression).
The CropBox is currently not supported by RadFixedPage class and is not preserved on an Import-Export scenario with PdfFormatProvider. CropBox is also not supported by PdfPageSource class and it is not preserved by using PdfStreamWriter as well. This property should be implemented in both scenarios.