From 903730dc26e215d9e8f412279d88f8e916011ee6 Mon Sep 17 00:00:00 2001 From: KB Bot Date: Fri, 13 Jun 2025 08:33:09 +0000 Subject: [PATCH 1/3] Added new kb article missing-content-pdf-radwordsprocessing --- .../missing-content-pdf-radwordsprocessing.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 knowledge-base/missing-content-pdf-radwordsprocessing.md diff --git a/knowledge-base/missing-content-pdf-radwordsprocessing.md b/knowledge-base/missing-content-pdf-radwordsprocessing.md new file mode 100644 index 00000000..1b44d741 --- /dev/null +++ b/knowledge-base/missing-content-pdf-radwordsprocessing.md @@ -0,0 +1,89 @@ +--- +title: Resolving Missing Content in Exported PDF Files +description: Learn how to handle missing content in PDF files generated using RadWordsProcessing for Document Processing due to custom fonts. +type: how-to +page_title: Fixing Missing Content in PDFs Generated with RadWordsProcessing +slug: missing-content-pdf-radwordsprocessing +tags: radwordsprocessing, document-processing, pdfprocessing, fonts, custom-fonts, fixedextensibilitymanager, fontsprovider +res_type: kb +ticketid: 1690314 +--- + +## Environment + +| Version | Product | Author | +| ---- | ---- | ---- | +| 2025.2.520| Telerik Document Processing|[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| + +## Description + +When generating PDF files using RadWordsProcessing from HTML or DOCX templates, specific content may be missing in the output due to custom fonts used in the document. This occurs because the .NET Standard version of RadPdfProcessing does not have a default mechanism to read fonts. To resolve this issue, the font data must be provided explicitly using the FixedExtensibilityManager and a custom implementation of the FontsProviderBase class. + +This knowledge base article also answers the following questions: +- Why is some text missing in RadWordsProcessing-generated PDFs? +- How do I add support for custom fonts in RadPdfProcessing? +- How can I fix missing content in exported PDF files? + +## Solution + +To ensure that custom fonts are correctly embedded in the PDF files: + +1. **Implement a FontsProvider**: + Create a custom class that inherits from `FontsProviderBase` and override the `GetFontData` method to provide the font data for the required fonts. + + Example implementation: + ```csharp + internal class FontsProvider : Telerik.Windows.Documents.Extensibility.FontsProviderBase + { + private string fontFolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts); + + public override byte[] GetFontData(Telerik.Windows.Documents.Core.Fonts.FontProperties fontProperties) + { + string fontFamilyName = fontProperties.FontFamilyName; + bool isBold = fontProperties.FontWeight == Telerik.Documents.Core.Fonts.FontWeights.Bold; + if (fontFamilyName == "David") + { + fontFolder = @"..\..\..\"; + var fontData = this.GetFontDataFromFontFolder("David.ttf"); + fontFolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts); + return fontData; + } + + Debug.WriteLine($"Font not found: {fontFamilyName} (Bold: {isBold})"); + return null; + } + + private byte[] GetFontDataFromFontFolder(string fontFileName) + { + using (FileStream fileStream = File.OpenRead(this.fontFolder + "\\" + fontFileName)) + { + using (MemoryStream memoryStream = new MemoryStream()) + { + fileStream.CopyTo(memoryStream); + return memoryStream.ToArray(); + } + } + } + } + ``` + +2. **Set the FontsProvider in FixedExtensibilityManager**: + Assign the custom FontsProvider implementation to the `FontsProvider` property of `FixedExtensibilityManager`. + + ```csharp + Telerik.Windows.Documents.Extensibility.FontsProviderBase fontsProvider = new FontsProvider(); + Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.FontsProvider = fontsProvider; + ``` + +3. **Ensure Font Availability**: + Download and include all necessary font files (e.g., `David.ttf`) used in your document. Place them in an accessible location relative to your application. + +4. **Rebuild and Run**: + Integrate the FontsProvider implementation into your application, rebuild, and test the PDF generation process. The previously missing content should now appear in the exported PDF files. + +## See Also + +- [FixedExtensibilityManager Documentation](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider) +- [RadWordsProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/overview) +- [PdfProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) +- [Implementing FontsProvider](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider) From 0537700574072db0a9fa221a4f4754a019471cd0 Mon Sep 17 00:00:00 2001 From: Desislava Yordanova Date: Wed, 18 Jun 2025 14:07:10 +0300 Subject: [PATCH 2/3] added new KB - Resolving Missing Content in Exported PDF Files --- knowledge-base/missing-content-pdf-radwordsprocessing.md | 9 +++------ libraries/radpdfprocessing/cross-platform/fonts.md | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/knowledge-base/missing-content-pdf-radwordsprocessing.md b/knowledge-base/missing-content-pdf-radwordsprocessing.md index 1b44d741..c5c2d076 100644 --- a/knowledge-base/missing-content-pdf-radwordsprocessing.md +++ b/knowledge-base/missing-content-pdf-radwordsprocessing.md @@ -4,7 +4,7 @@ description: Learn how to handle missing content in PDF files generated using Ra type: how-to page_title: Fixing Missing Content in PDFs Generated with RadWordsProcessing slug: missing-content-pdf-radwordsprocessing -tags: radwordsprocessing, document-processing, pdfprocessing, fonts, custom-fonts, fixedextensibilitymanager, fontsprovider +tags: words, processing, document, pdf, font, custom, fixedextensibilitymanager, fontsprovider res_type: kb ticketid: 1690314 --- @@ -17,7 +17,7 @@ ticketid: 1690314 ## Description -When generating PDF files using RadWordsProcessing from HTML or DOCX templates, specific content may be missing in the output due to custom fonts used in the document. This occurs because the .NET Standard version of RadPdfProcessing does not have a default mechanism to read fonts. To resolve this issue, the font data must be provided explicitly using the FixedExtensibilityManager and a custom implementation of the FontsProviderBase class. +When generating PDF files using [RadWordsProcessing]({%slug radwordsprocessing-overview%}) from HTML or DOCX templates, specific content may be **missing** in the output due to custom fonts used in the document. This occurs because the .NET Standard version of [RadPdfProcessing]({%slug radpdfprocessing-overview%}) does not have a default mechanism to read fonts. To resolve this issue, the font data must be provided explicitly using the **FixedExtensibilityManager** and a custom implementation of the [FontsProviderBase]({%slug pdfprocessing-implement-fontsprovider%}) class. This knowledge base article also answers the following questions: - Why is some text missing in RadWordsProcessing-generated PDFs? @@ -83,7 +83,4 @@ To ensure that custom fonts are correctly embedded in the PDF files: ## See Also -- [FixedExtensibilityManager Documentation](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider) -- [RadWordsProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/overview) -- [PdfProcessing Overview](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) -- [Implementing FontsProvider](https://docs.telerik.com/devtools/document-processing/knowledge-base/pdfprocessing-implement-fontsprovider) +- [Implementing FontsProvider]({%slug pdfprocessing-implement-fontsprovider%}) diff --git a/libraries/radpdfprocessing/cross-platform/fonts.md b/libraries/radpdfprocessing/cross-platform/fonts.md index d53fa561..405e7ac6 100644 --- a/libraries/radpdfprocessing/cross-platform/fonts.md +++ b/libraries/radpdfprocessing/cross-platform/fonts.md @@ -26,4 +26,5 @@ You can find a detailed **FixedExtensibilityManager** and **FontsProvider** desc * [Cross-Platform Support]({%slug radpdfprocessing-cross-platform%}) * [Inserting Special Symbols in PDF using RadPdfProcessing]({%slug inserting-special-symbols-pdf-radpdfprocessing%}) * [How to Eliminate Formatting Issues when Exporting XLSX to PDF Format]({%slug exporting-xlsx-to-pdf-formatting-issues%}) + * [Resolving Missing Content in Exported PDF Files]({%slug missing-content-pdf-radwordsprocessing%}) From 498892b5602e981c95c365b7c44f10b08d9394a6 Mon Sep 17 00:00:00 2001 From: Desislava Yordanova Date: Thu, 19 Jun 2025 09:05:39 +0300 Subject: [PATCH 3/3] addressed feedback --- .../missing-content-pdf-radwordsprocessing.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/knowledge-base/missing-content-pdf-radwordsprocessing.md b/knowledge-base/missing-content-pdf-radwordsprocessing.md index c5c2d076..2aec702e 100644 --- a/knowledge-base/missing-content-pdf-radwordsprocessing.md +++ b/knowledge-base/missing-content-pdf-radwordsprocessing.md @@ -1,10 +1,10 @@ --- -title: Resolving Missing Content in Exported PDF Files -description: Learn how to handle missing content in PDF files generated using RadWordsProcessing for Document Processing due to custom fonts. +title: Resolving missing content after HTML/DOCX to PDF conversion with WordsProcessing in .NET Standard +description: Learn how to handle missing content in PDF files generated using RadWordsProcessing for Document Processing due to fonts' specifics. type: how-to page_title: Fixing Missing Content in PDFs Generated with RadWordsProcessing -slug: missing-content-pdf-radwordsprocessing -tags: words, processing, document, pdf, font, custom, fixedextensibilitymanager, fontsprovider +slug: missing-content-word-to-pdf-radwordsprocessing +tags: words, processing, document, pdf, font, custom, fixedextensibilitymanager, fontsprovider, netstandard res_type: kb ticketid: 1690314 --- @@ -17,7 +17,7 @@ ticketid: 1690314 ## Description -When generating PDF files using [RadWordsProcessing]({%slug radwordsprocessing-overview%}) from HTML or DOCX templates, specific content may be **missing** in the output due to custom fonts used in the document. This occurs because the .NET Standard version of [RadPdfProcessing]({%slug radpdfprocessing-overview%}) does not have a default mechanism to read fonts. To resolve this issue, the font data must be provided explicitly using the **FixedExtensibilityManager** and a custom implementation of the [FontsProviderBase]({%slug pdfprocessing-implement-fontsprovider%}) class. +When generating PDF files using [RadWordsProcessing]({%slug radwordsprocessing-overview%}) from HTML or DOCX templates, specific content may be **missing** in the output due to the fonts used in the document. This occurs because the .NET Standard version of [RadPdfProcessing]({%slug radpdfprocessing-overview%}) does not have a default mechanism to read fonts. To resolve this issue, the font data must be provided explicitly using the **FixedExtensibilityManager** and a custom implementation of the [FontsProviderBase]({%slug pdfprocessing-implement-fontsprovider%}) class. This knowledge base article also answers the following questions: - Why is some text missing in RadWordsProcessing-generated PDFs? @@ -84,3 +84,4 @@ To ensure that custom fonts are correctly embedded in the PDF files: ## See Also - [Implementing FontsProvider]({%slug pdfprocessing-implement-fontsprovider%}) +- [Standard Fonts]({%slug radpdfprocessing-concepts-fonts%})