PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue May 23, 2017 6:55 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Aug 24, 2016 2:50 pm 
Offline

Joined: Wed Aug 24, 2016 9:31 am
Posts: 8
I would like to turn off font embedding.

In version 1.32, Unicode fonts are embedded and ANSI fonts are not (with PdfFontEmbedding.None).
Apparently the option was removed in version 1.5. Is there a "hack" available to turn it off?

Font embedding raises a licensing issue, that's why I want to turn it off.

The Monotype Imaging EULA applies for most fonts in Windows (as far as I know).

"You may embed the Font Software only into an electronic document that (i) is not a Commercial Product, (ii) is distributed in a secure format that does not permit the extraction of the embedded Font Software, and (iii) in the case where a recipient of an electronic document is able to Use the Font Software for editing, only if the recipient of such document is within your Licensed Unit."

Is the PDF a secure format that does not permit the extraction of the Font?


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2016 3:43 pm 
Offline

Joined: Wed Aug 24, 2016 9:31 am
Posts: 8
I want to note that font embedding drastically increases the PDF file size from 4KB to 13MB. I use Noto Sans CJK SC font (Chinese). I tried to modify version 1.5 to support external font, but without success.

PdfDocument.cs
Uncomment line 460,461

PdfType0Font.cs
Uncomment line 70

This produces a 4KB file but there is a font not found message by Acrobat Reader. Any ideas?


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2016 7:25 pm 
Offline

Joined: Wed Aug 24, 2016 9:31 am
Posts: 8
If it is not possible to turn of font embedding for Unicode fonts in PDF format, I suggest that font embedding can be optimized to only include characters used in the document. The font I am using is "Noto Sans CJK SC" and it produced a 13MB output file for 12 characters.


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 25, 2016 9:57 pm 
Offline

Joined: Wed Aug 24, 2016 9:31 am
Posts: 8
I found out that the font-name in the PDF must be like the filename of the otf file of the font.
for example: "SourceHanSansSC-Regular".

Then it worked. I added a new line to set the BaseFont variable accordingly after line 70, PdfType0Font.cs.


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 29, 2016 10:32 am 
Offline

Joined: Tue Aug 02, 2016 9:56 am
Posts: 35
Location: Amsterdam, The Netherlands
It is not possible to turn off font embedding in all situations, but it may be possible in some cases for CJK fonts. See https://forums.adobe.com/thread/2127278 for a different situation in which I was not able to get rid of the "font not found" message because I wanted full Unicode coverage, not just CJK.

The general direction PDF is going in is to embed all fonts, because you cannot in general rely on the same font, or even a similar font with the same internal encoding, to be installed on other machines.

_________________
Gerben Vos
Developer, ZyLAB Technologies B.V.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group