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.
When merging documents` pages using the PdfStreamWriter the Form Fields are not copied:
using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(document2Name)))
{
// Iterate through the files you would like to merge
for (int i = 0; i < 2; i++)
{
// Open each of the files
using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(document1Name)))
{
// Iterate through the pages of the current document
foreach (PdfPageSource pageToMerge in fileToMerge.Pages)
{
// Append the current page to the fileWriter, which holds the stream of the result file
fileWriter.WritePage(pageToMerge);
}
}
}
}
A possible workaround is to use the RadFixedDocument`s Merge() method:
document1.Merge(document2);
When using the Telerik.Documents.ImageUtils.JpegImageConverter default implementation in Blazor WebAssembly application the Magick.NET library doesn't load all of its assemblies.
Workaround:
Create a custom implementation of the JpegImageConverterBase class: Create Custom JpegImageConverter in .Net Standard.
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'.'