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.
There is a wrong reference in the WPF .NET Core version of Telerik.Windows.Document.Fixed.dll that causes a FileLoadException with the message "Could not load file or assembly 'System.Drawing.Common, Version=5.0.0.0'"
Workaround: Add NuGet reference to System.Drawing.Common, version 5.0.0.0. Note: mark "Include prerelease" so you can see it in the NuGet Package Manager
Tables should ignore fixed proffered width with the value of 0, this is the default behavior in Word as well.
Workaround (when converting Flow to PDF documents):
foreach (var item in tables)
{
if (item.PreferredWidth.Type == Telerik.Windows.Documents.Flow.Model.Styles.TableWidthUnitType.Fixed &&
item.PreferredWidth.Value == 0)
{
item.PreferredWidth = new Telerik.Windows.Documents.Flow.Model.Styles.TableWidthUnit(Telerik.Windows.Documents.Flow.Model.Styles.TableWidthUnitType.Percent, 100);
}
}
or there should be an optional parameter "bool AcceptNewlines" or "bool IgnoreNewlines"
Currently, this can be implemented like this:
private void InsertTextWithNewlines(Block block, string text)
{
string[] lines = text.Split(new[] {"\r\n", "\r", "\n"}, StringSplitOptions.None);
for (int i = 0; i < lines.Length; i++)
{
block.InsertText(lines[i]);
if (i < lines.Length - 1)
{
block.InsertLineBreak();
}
}
}
An InvalidCastException is thrown when importing documents containing outlines with an invalid destination set:
The exception:
System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfReal' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfName'.'
This exception corrupts the whole document import. Instead, we should provide Exception handling mechanism which allows the user to import the rest of the content.
When importing document with predefined ToUnicode CMaps (e.g. Identity-H), an InvalidCastException is thrown with cause: Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfName' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.CMaps.ToUnicodeCMap'.
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.