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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Merging PDF's How to embed Fonts

Thread ID:

Created:

Updated:

Platform:

Replies:

132982 Oct 2,2017 07:33 PM UTC Oct 5,2017 10:00 AM UTC Windows Forms 3
loading
Tags: PDF
Aaron Knipe
Asked On October 2, 2017 07:33 PM UTC

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);
pdf.Pages.RemoveAt(0);
newPDF.Append(pdf);
/* Cleanup */
pdf.Close(true);
File.Delete(file);
}
newPDF.Save(newPDFFileName);
newPDF.Close(true);

Surya Kumar [Syncfusion]
Replied On 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: 
 
Note: 
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. 
 
Regards, 
Surya Kumar 


Aaron Knipe
Replied On 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}



Surya Kumar [Syncfusion]
Replied On 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.  

Regards, 
Surya Kumar 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;