When merging documents containing the same embedded font every time a document is merged the same font is repeatedly embedded in the merged document. This leads to very large files.
A possible workaround before this feature is developed could be to use the PdfProcessing model to import and merge the documents. After the documents are merged to iterate the document`s content in order to cache the fonts using their name and if there are duplicated names to set the already cached one (check the attached project).
As a side note, the suggested workaround doesn't cover all possible cases (e.g. if there are fonts with a common name but different font sets (modified fonts or font subsets) this may lead to missing/different characters in the produced document). So in order to use this workaround, you will need to ensure the font names are unique for every different font.
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'.'
ArgumentOutOfRangeException is thrown when importing a document because of wrongly parsing to Unicode mapping.
System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index'
According to the PDF specification:
A clipping path operator (W or W*) may appear after the last path construction operator and before the path-painting operator that terminates a path object.
Invalid:
W % clipping path operator 0 0 m % start of the path construction 596 0 l 596 842 l 0 842 l h % end of the path construction n % path-painting operator
0 0 m 596 0 l 596 842 l 0 842 l h W n
Currently (in the invalid cases), the path construction is skipped on import.