We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Merging PDF's How to embed Fonts

I am Appending Several Pdfs into a new single PdfDocument. The files that I am using have a font referenced which is on my system. I would like to embed the font into the merged file, but it doesnt seem to be working. I have seen the examples where the font is referenced and then a string is writting to a page. In my case I am not writing any new pages, simply appending from one to another. How would I specify a font to embedded into the final saved pdf?
var newPDFFileName = string.Format("{0}\\{1}_AllFiles_Merged.pdf", _FolderPath, WorkOrderNumber);
//var newPDF = new Document();
var newPDF = new PdfDocument();
foreach(var file in _Files) {
var pdf = new PdfLoadedDocument(file);
/* Cleanup */

5 Replies

SK Surya Kumar Syncfusion Team October 3, 2017 04:40 PM UTC

Hi Aaron, 
Thank you for using Syncfusion products. 
At present we do not have support for Embedding all the font in PDF document while performing merge operation. We have logged a feature request for the same and we will let you know once this feature is implemented. 
However, we have created a simple workaround for embed font while merging multiple documents by replacing the used font from loaded document with embedded font, the sample for the same can be downloaded from below link: 
1.This works only when the font to be embedded is present in the system. 
2.Embedding font will increase the file size than the parent file size. 
Surya Kumar 

AK Aaron Knipe October 4, 2017 04:29 PM UTC

Thanks for the quick response.  I think your sample will get me to where I need to be, however I ran into an exception while implementing it (screenshot below).  Is there a way to set the emSize? I did a search in the forums and didnt find anything related to this, and I didnt see anything in your example that deals with this either.  Could the issue be in the pdfs that I am working with?

pdfLoadForFontEmbedding.UsedFonts 'pdfLoadForFontEmbedding.UsedFonts' threw an exception of type 'System.ArgumentException' Syncfusion.Pdf.Graphics.Fonts.PdfUsedFont[] {System.ArgumentException}

SK Surya Kumar Syncfusion Team October 5, 2017 10:00 AM UTC

Hi Aaron, 
We were able to reproduce the issue and we have confirmed this as bug and logged a report on this. Also, we have created a support incident under your account to track the status of this issue.  
Please log on to our support website to check for further updates.  

Surya Kumar 

EF Effy January 29, 2019 09:39 AM UTC

We ran into the same issue, using the .NET Core libraries.
However, the UsedFonts property is missing on the .NET Core release.
Is there another workaround?

Thank you,

KC Karthikeyan Chandrasekar Syncfusion Team January 30, 2019 12:06 PM UTC

Hi Effy, 
At present we do not have support for retrieving UsedFonts information from PdfLoadedDocument  in .Net Core platform and there is no other workaround to get the same. We have logged the feature request for the same and we will let you know once this feature is implemented. 

Live Chat Icon For mobile
Up arrow icon