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);
Merging multiplies the embedded fonts
Re: Merging multiplies the embedded fonts
Support · Oct 30, 2014Hello,
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.
Re: Merging multiplies the embedded fonts
Forum member · Oct 30, 2014Thank 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.
Re: Merging multiplies the embedded fonts
Forum member · Jan 9, 2015Font sub setting when manipulating existing PDFs would definitely help my organisation too.
Re: Merging multiplies the embedded fonts
Forum member · Jan 9, 2015Is 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.
Re: Merging multiplies the embedded fonts
Support · Jan 12, 2015Hello,
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.
Re: Merging multiplies the embedded fonts
Forum member · Oct 28, 2015Really need this feature also. Has this been implemented yet?
Re: Merging multiplies the embedded fonts
Support · Oct 28, 2015Hello,
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.
Re: Merging multiplies the embedded fonts
Forum member · Jun 28, 2017Has this been implemented yet - optimizing embedded fonts in merged pdfs?
Re: Merging multiplies the embedded fonts
Support · Jul 3, 2017Hello,
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
Re: Merging multiplies the embedded fonts
Forum member · Apr 9, 2018How about now?
Re: Merging multiplies the embedded fonts
Support · Apr 9, 2018Hello,
Font optimization feature is not available yet.
Thanks,
ceTe Software Support Team
Re: Merging multiplies the embedded fonts
Forum member · Apr 9, 2018Well, I guess I'm wondering if there is any plan at all to address this. The original post was 4 YEARS ago...
Re: Merging multiplies the embedded fonts
Support · Apr 10, 2018Hello,
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
Re: Merging multiplies the embedded fonts
Forum member · Aug 4, 2020Is this available yet?
Re: Merging multiplies the embedded fonts
Support · Aug 4, 2020Hello,
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
Re: Merging multiplies the embedded fonts
Forum member · Apr 29, 2021Is there an example of font sharing?
Re: Merging multiplies the embedded fonts
Support · Apr 29, 2021Hello,
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