So this will only work if the FONT dictionary specifies a /Subtype  
of /TrueType, an /Encoding of /WinANSIEncoding and does not have a / 
Differences array - correct?

There is no support for Type 1, Type 1C, Mac encodings, for custom  
encodings or for CID fonts, correct?

Also, how do you determine in the case of multiple subsets that the  
fonts were from the same font originally?  Only by /BaseFont name?

Leonard

On Jan 31, 2008, at 1:02 PM, Lari Hotari wrote:

>
> This contribution is about TTF font merging and replacement, but it  
> should
> help with the original font problem. It would also be possible to  
> continue
> developing this code to remove embedded fonts and replace them with  
> pdf
> document fonts. With this code you can remove other fonts and  
> replace them
> with some TTF font.
>
> Here's (itext_font_merging_patch.zip) some additional classes to
> com.lowagie.text.pdf .
> http://www.nabble.com/file/p15203186/itext_font_merging_patch.zip
> itext_font_merging_patch.zip
> The main class is FontReplacingPdfSmartCopy (extends PdfSmartCopy).
>
> This subclass of PdfSmartCopy will replace different subsets of the  
> same
> font in the resulting pdf file with one font (same font name or  
> replacement
> can be also done). It needs the TrueType font files (TTF) to do the  
> job.
>
> This usually reduces the final PDF file size by 40%-60% compared to  
> plain
> PdfSmartCopy when several single page pdfs are merged in to one big  
> pdf
> file.
>
> The original motivation was to make it possible to print very large  
> pdf
> files which have been concatenated of thousands of small pdf files
> containing the same fonts. Some printers just clog when they receive
> thounsands of embedded fonts in a single print job. Maybe the  
> reason is that
> the resulting Postscript files are quite huge when there's  
> thousands of
> embedded fonts. Having less fonts makes it more simple to print- 
> process the
> concatenated pdf. It also uses less disk space.
>
> Merging/replacement currently works only with WinAnsiEncoding  
> (iso-8859-1 /
> Cp1252 / latin1)
>
> Page resources are scanned while copying and it checks for a  
> dictionary
> under FONT key. Possible FONT references in the font dictionary are  
> replaced
> on demand. The new font will get a new indirect reference and the  
> font will
> be written to the stream in the overridden
> PdfWriter.addSharedObjectsToBody() method.
>
> This class has to be in the com.lowagie.itext.pdf package because  
> it needs
> access to some package private methods.
>
> I would like to contribute this implementation to the community and  
> I hope
> this gets in to the itext release as soon as possible. Bruno or  
> Paulo, can
> you add this to the itext release?
>
> There's also a helper class for concatenating pdfs.
>
> PdfConcator makes it easier to concatenate multiple PDF files in to  
> a single
> PDF file. It uses FontReplacingPdfSmartCopy to reduce the number of  
> fonts in
> the resulting PDF file. It's also possible to replace TTF fonts  
> with other
> fonts. Sample usage:
>
>
>  PdfConcator pdfConcator=new PdfConcator();
>  pdfConcator.setFontDir(new File("fonts")); // or
> pdfConcator.useDefaultSystemFonts();
>  Map fontNameMapping = new HashMap();
>  fontNameMapping.put("ComicSansMS", "Arial-Black");
>  pdfConcator.setFontNameMapping(fontNameMapping);
>
>  List files = new ArrayList();
>  files.add("pdf1.pdf");
>  files.add("pdf2.pdf");
>  pdfConcator.concat(files, new File("concat.pdf"));
>
>  Supports IoC/DI. Example Spring configuration xml:
>
>     <beans xsi:schemaLocation="http://www.springframework.org/ 
> schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>       <bean id="pdfConcator" class="com.lowagie.text.pdf.PdfConcator">
>         <property name="fonts">
>           <bean factory-bean="fontArrayFactory"
> factory-method="getInstance"/>
>         </property>
>         <property name="fontNameMapping">
>           <map>
>             <entry key="ComicSansMS" value="ArialMT"/>
>           </map>
>         </property>
>       </bean>
>       <bean id="fontArrayFactory"
> class="com.lowagie.text.pdf.BaseFontArrayFactory">
>         <property name="fontDirs">
>           <list>
>             <value>C:/myfonts</value>
>             <value>fonts</value>
>             <value>/usr/share/fonts/truetype/msttcorefonts</value>
>             <value>C:/WINDOWS/FONTS</value>
>           </list>
>         </property>
>         <property name="extensions" value="ttf,otf"/>
>         <property name="ignoreUnreadable" value="true"/>
>       </bean>
>     </beans>
>
>
> Regards,
>
> Lari Hotari
>
>
>
> Bruno Lowagie (iText) wrote:
>>
>> new2pdf wrote:
>>> Is there a better way of doing this?
>>
>> That's not a question I can answer in only a few lines.
>> Due to lack of time, I have to pass on this question for now.
>> Maybe somebody else can explain how to remove fonts
>> (although that's always a very delicate matter).
>> br,
>> Bruno
>>
>>
>> --------------------------------------------------------------------- 
>> ----
>> SF.Net email is sponsored by: The Future of Linux Business White  
>> Paper
>> from Novell.  From the desktop to the data center, Linux is going
>> mainstream.  Let it simplify your IT future.
>> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>> Buy the iText book: http://itext.ugent.be/itext-in-action/
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/How-to-remove- 
> embedded-fonts-from-a-pdf-document-tp14033717p15203186.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to