Merging multiplies the embedded fonts

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v7)  /  Merging multiplies the embedded fonts

DynamicPDF CoreSuite for .NET (v7) Forum

 Oct 30 2014 12:12 PM
We use Merger to stitch together a set of documents into one, combined PDF file to send to our printer.  One thing we noticed that the embedded fonts for each individual document get added to the merged document, even if they are the same.

For example, file1.pdf used the Calibri font and is embedded.  file2.pdf also used the Calibri font and that is embedded in that pdf.  When I create a merged document of the two, I get a duplicate set of Calibri embedded fonts.  Now imagine combining a hundred or more individual pdfs... the file size is huge, 80% of which is the embedded fonts, all of which are dupes.

Is there a way to prevent this?  Or at the very least, programmatically then remove the duplicate embedded fonts?

I can reproduce this with the most simple of code:

 string path = "c:\\somepath";
 string mergeFileName = Path.Combine(path, "mergedoc.pdf");

 MergeDocument mergeDoc = new MergeDocument();            
 mergeDoc.Append(Path.Combine(path, "file1.pdf"));
 mergeDoc.Append(Path.Combine(path, "file.pdf"));
 mergeDoc.Draw(mergeFileName);

Posted by a ceTe Software moderator
Hello,

Currently it is not possible to consolidate or optimize the fonts while merging the PDFs. We will add this feature to our wish list for consideration, but we do not have an exact time line on when it will be implemented. It is also not possible to remove the duplicate embedded fonts programmatically.

Thanks,
ceTe Software Support Team.
Thank you for the response.  Please do add this to your feature-to-do-list... and as soon as possible! 

I created a test MergeDoc by appending three base pdfs, and looping on those same 3 pdfs a few times in a loop.  I got a resulting PDF that was over 600k; and if you looked at the Document Properties, Fonts Used... dialog, you could see all the repeating references.

In Acrobat Pro, I simple resaved the file as an "Optimized" PDF, making sure I selected the “Subset all embedded fonts” option on the Fonts panel... that took the file down to less than 200k (1/3 of the size!).  And, again, looking at the Document Properties dialog, the Fonts Used tab was all cleaned up.

We routinely create MergeDocs on a daily basis (for printing customer documentation, etc.), and are now generating 50mb files.  Every day.  You can imagine that cutting that down by two-thirds would be extremely helpful.



Font sub setting when manipulating existing PDFs would definitely help my organisation too.
Is there any update on when this might be worked into DynamicPDF? We use your library because we automate the creation of docs... a lot of them, every day.  So this would really make a huge difference in storage requirements for us.
Posted by a ceTe Software moderator
Hello,

We are exploring the possibility of implementing this feature (font optimization) for next version (v9). Once this feature is implemented we would update any related forums with details and offer beta version for testing.

With regards to timeline, I just want to point out that we have recently released v8 and are nowhere near releasing v9.

Thanks,
ceTe Software Support Team.
Really need this feature also. Has this been implemented yet?
Posted by a ceTe Software moderator
Hello,

The font optimization feature has not been implemented yet. It is in our wish list and is being considered for v9. As of now we do not have a timeframe on when this feature will be released.

Thanks,
ceTe Software Support Team.
Has this been implemented yet - optimizing embedded fonts in merged pdfs?
Posted by a ceTe Software moderator
Hello,

The font optimizing feature has not yet been implemented (it is still on our wish list though). It still has a realistic opportunity to make it into a future version but nothing concrete is planned for it at this time.

Thanks,
ceTe Software Support Team
How about now?
Posted by a ceTe Software moderator
Hello,

Font optimization feature is not available yet.

Thanks,
ceTe Software Support Team
Well, I guess I'm wondering if there is any plan at all to address this.  The original post was 4 YEARS ago... 
Posted by a ceTe Software moderator
Hello,

We did look into the possibility of implementing font optimization for v9 but it turned out to be a very complex feature. We do have plans to implement it for a future version but at this moment we do not know when that will happen.

Thanks,
ceTe Software Support Team


Is this available yet?
Posted by a ceTe Software moderator
Hello,

A font sharing feature for TrueType and Type0 is included in the latest DynamicPDF Core Suite for .NET (v11 currently in BETA). Try installing that and see if it resolves the issue. You can get it from NuGet (product ID: ceTe.DynamicPDF.CoreSuite.NET), but you will need to check the "include prereleases" check box to see the BETA version for v11.  Also you can download it from our website here.

Thanks,
ceTe Software Support Team

Is there an example of font sharing?
Posted by a ceTe Software moderator
Hello,

Here is a code snippet to enable font sharing in version 11:

            DocumentOptimization opt = new DocumentOptimization();
            opt.Fonts = true;
            MergeDocument document = new MergeDocument();
            document.Append(@"Input PDF file path");
            document.Append(@"Another input PDF file path");
            document.Optimization = opt;
            document.Draw(@"C:\Temp\Mydocument.pdf");

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 10:13 PM.