Exactly!

Well, normally this is done as part of the content stream generation and font 
subletting process.  You can see how iText itself does it during PDF creation 
by reviewing the code used to produce the text operators.

I suspect that you will need to do something similar as you rewrite each stream 
and subset each font.

Leonard

From: WMJ <sd_...@yahoo.com<mailto:sd_...@yahoo.com>>
Reply-To: WMJ <sd_...@yahoo.com<mailto:sd_...@yahoo.com>>, Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
To: Post here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Subject: Re: [iText-questions] How to subset fonts into an existing PDF file

I see. I've got to replace the original character code to the glyph index of 
the subset font.

Now, how can I get the needed font data and the index of the extracted glyphs?


________________________________
From: Leonard Rosenthol <lrose...@adobe.com<mailto:lrose...@adobe.com>>
To: WMJ <sd_...@yahoo.com<mailto:sd_...@yahoo.com>>; Post all your questions 
about iText here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Sent: Friday, September 7, 2012 7:34 PM
Subject: RE: [iText-questions] How to subset fonts into an existing PDF file

Yes, you must.   Because in a subset font, you no longer use standard encodings 
(such as ASCII or SJIS or Unicode) – it’s always a custom encoding.  As such, 
you need to remap your values to the new encoding.

Leonard

From: WMJ [mailto:sd_...@yahoo.com]
Sent: Thursday, September 06, 2012 9:03 PM
To: iTextQuestions
Subject: Re: [iText-questions] How to subset fonts into an existing PDF file

Hi,

Thanks for the information.
Must I rewrite the page content stream?
Since the character code in the original document lacks a ToUnicode section, 
thus all content streams in the document which use that font share the same 
encoding.
I think that reconstructing a ToUnicode stream for that font is sufficient.

________________________________
From: Leonard Rosenthol <lrose...@adobe.com<mailto:lrose...@adobe.com>>
To: WMJ <sd_...@yahoo.com<mailto:sd_...@yahoo.com>>
Sent: Thursday, September 6, 2012 8:30 PM
Subject: RE: [iText-questions] How to subset fonts into an existing PDF file

Because of the way that font subsetting works, you can’t just “inject them into 
the PDF”.  You will also need to rewrite every single content stream in the PDF 
that refers to that font, since the character code references will no longer be 
correct.

Leonard

From: WMJ [mailto:sd_...@yahoo.com]<mailto:[mailto:sd_...@yahoo.com]>
Sent: Thursday, September 06, 2012 8:17 AM
To: Leonard Rosenthol
Subject: Re: [iText-questions] How to subset fonts into an existing PDF file

Hi,

I know quite well about the differences between embedding and subsetting and I 
do have the font ready for subsetting. By scanning and analyzing the document 
with iText, I also know quite well what characters will be needed in the 
subsetting process.

For example, now I have a PDF document which uses an external font, FontA for 
instance, which is already installed on my computer. So, the document looks OK, 
but on other computers without FontA, it is unreadable.
The PDF document uses 10,000 characters and the FontA has 30,000 characters 
available. Embedding the whole FontA is uneconomic, since the other 20,000 
characters are not used by the document. Therefore, I want to extract the 
needed 10,000 character data from FontA and subset them to that PDF document. 
Afterward, the document is portable to other computers which do not have FontA 
installed.

I just wonder whether there's a way to extract the needed character data from 
the existing font and inject them into existing PDF files.

Embedding is well explained in the book iText in Action. Could you please tell 
me if there are APIs available for subsetting?



________________________________
From: Leonard Rosenthol <lrose...@adobe.com<mailto:lrose...@adobe.com>>
To: WMJ <sd_...@yahoo.com<mailto:sd_...@yahoo.com>>; Post all your questions 
about iText here 
<itext-questions@lists.sourceforge.net<mailto:itext-questions@lists.sourceforge.net>>
Sent: Thursday, September 6, 2012 7:33 PM
Subject: RE: [iText-questions] How to subset fonts into an existing PDF file

I think you are confusing EMBEDDED (where some/all of the font data lives 
inside of the PDF) with SUBSETTED (where the font is embedded BUT only part of 
it).   If the fonts aren’t installed and you have problems, that EMBEDDED.

So forget about subsetting, you just need to embed.

And in order to do that, you will need to have the fonts and then it it’s 
fairly straightforward to embed them into a PDF.

Leonard

From: WMJ [mailto:sd_...@yahoo.com]<mailto:[mailto:sd_...@yahoo.com]>
Sent: Wednesday, September 05, 2012 11:34 PM
To: iTextQuestions
Subject: [iText-questions] How to subset fonts into an existing PDF file

I've gotten an existing PDF file which contains fonts that is not subsetted. If 
the fonts are not installed in the system, the document can't be displayed 
correctly. I definitely know what fonts are suitable for those document. How 
can I subset those fonts into the PDF file?




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
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