Okay, IF the font's encoding is not "Identity-H", you can often (but not
always) get away with removing the font stream.

Step 0:  Get the font resource dictionary.
Step 1:  Get the font descriptor dictionary.
Step 2:  Remove the following keys (only one will be present)
    PdfName.FONTFILE
    PdfName.FONTFILE2
    PdfName.FONTFILE3

That's it.


The font resource dictionary will have an entry, PdName.ENCODING.  If
that entry is a PdfString, it'll be a standard encoding (they all end
with "Encoding"), the name of a Cmap (no particular standard naming), a
stream, or a dictionary.  The only thing you REALLY need to worry about
are the strings that begin with "Identity-" (Identity-H and Identity-V),
and the streams (custom Cmaps built for that font).

Stripping the embedding from a font with one of the above Danger Signs
will result in text that cannot be extracted outside of OCR (Optical
Character Recognition).

In any event, you can end up with text that Looks Awful.  If you're
willing to accept that risk, then go for it.


Replacing a font is likely to produce something that Looks Horrifically
Awful unless you rebuild the content stream for that new font.  This
would be extraordinarily challenging for a PDF Expert, and is for all
intents and purposes impossible for someone who is not.

To get some idea of why this is so, I suggest you google the words
"kerning" and "ligatures", as separate searches... Two different topics.


--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 

> -----Original Message-----
> From: Leonard Rosenthol [mailto:lrose...@adobe.com] 
> Sent: Wednesday, December 22, 2010 8:52 PM
> To: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] how to remove embedded font stream
> 
> No, there is no sample code and it's NOT a trivial exercise.
> 
> Embedded fonts are the proper way to do things.  Removing 
> them doesn't solve any problems - it only introduces new ones.
> 
> -----Original Message-----
> From: zhouxiang [mailto:344819...@qq.com]
> Sent: Wednesday, December 22, 2010 10:21 PM
> To: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] how to remove embedded font stream
> 
> 
> hi,1T3XT BVBA,thanks for your kind reply.
> i'm new to itext ,after reading the chapter 16 and the 
> itext's api for many
> times ,but still don't know how to remove the font 
> stream.forgive me,i'm
> always a stupid student.is there any example code?
> 
> in your reply,you mentioned that  rewrite all the content 
> streams in the
> document from scratch.if there a way to copy original pdf but 
> just make that
> font not embedded,the problem may be resolved.how to do that?
> 
> thanks.
> -- 
> View this message in context: 
> http://itext-general.2136553.n4.nabble.com/how-to-remove-embed
ded-font-stream-tp3160411p3161585.html
> Sent from the iText - General mailing list archive at Nabble.com.
> 
> --------------------------------------------------------------
> ----------------
> Learn how Oracle Real Application Clusters (RAC) One Node 
> allows customers
> to consolidate database storage, standardize their database 
> environment, and, 
> should the need arise, upgrade to a full multi-node Oracle 
> RAC database 
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Many questions posted to this list can (and will) be answered 
> with a reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php
> 
> --------------------------------------------------------------
> ----------------
> Learn how Oracle Real Application Clusters (RAC) One Node 
> allows customers
> to consolidate database storage, standardize their database 
> environment, and, 
> should the need arise, upgrade to a full multi-node Oracle 
> RAC database 
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Many questions posted to this list can (and will) be answered 
> with a reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php
> 
> 

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to