Did you read what I wrote?  The simple answer is don't use postscript.  Is 
there a particular reason you must use the postscript format?
I tried getting the output in postscript format and it didn't turn out well.  I 
believe they said to use that format you should only use type 1 fonts.
If you get the document as a byte stream you can pass it into the pdfbox 
program which builds a Pageable pdf document still in memory.  No physical 
files are required with this method.  You can pass the pdfbox PDDocument to a 
Java PrinterJob and just print it.
I embed one standard font, which is up to 3 fonts (one for normal, one for 
bold, one for some unicode characters).  I chose Lucida Typewriter for 
everything because it is the most readable fixed width font.

-----Original Message-----
From: mehdi houshmand [mailto:med1...@gmail.com] 
Sent: Wednesday, January 19, 2011 9:29 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: How much work is needed for FOP to support OpenType fonts?

Hi Eric,

I'm afraid it's not that simple, PostScript doens't accept a byte stream as PDF 
does. In order to embed fonts into a PostScript document, the font must be 
streamed to an ASCII hexadecimal stream. As you can imagine, this bloats the 
size quite significantly, and imagine if you have several fonts, all fully 
embedded. One of my test documents was 100+ MB, that's clearly unacceptable and 
crashes a two of the 3 printers I use for testing. This isn't as much of an 
issue in PDF since you can stream bytes directly to the document.


On 19 January 2011 14:22, Eric Douglas <edoug...@blockhouse.com> wrote:
> I'd like to know what sort of document you're trying to print and what 
> sort of printer you're using if it won't accept a truetype font.
> I only print truetype fonts (lucida typewriter) with FOP and I have no 
> problems printing to brand new lasers or dot matrix which are at least 
> 10 years old.
> I don't know how much document size might affect that or if you could 
> do some special processing to handle large documents.
> Our typical printout from that program going to the old dot matrix 
> printer is 2-3 pages and a large printout might be 5-10 pages.
> I haven't had any size issues with embedding the full font since the 
> typical 2 page printout is about a 60kb pdf.  That's including an 
> embedded svg image on every page.
> If your printouts don't work maybe you could try printing differently.
> I print using embedded code.  I create a new Fop object using a new 
> ByteArrayOutputStream, then create a new SAXResult from that Fop's 
> DefaultHandler.  Then I pass the SAXResult into a transform which puts 
> the document into that ByteArrayOutputStream.  Then I get the document 
> from the stream with it's toByteArray and pass those bytes into a 
> ByteArrayInputStream which I can load into a pdfbox object, which is a 
> Pageable object I just pass to the Java print method and it just works 
> on any printer.  It has the old dot matrix printers printing graphics 
> and variable font sizes I didn't know they were capable of.
> -----Original Message-----
> From: mehdi houshmand [mailto:med1...@gmail.com]
> Sent: Wednesday, January 19, 2011 5:06 AM
> To: fop-dev@xmlgraphics.apache.org
> Subject: Re: How much work is needed for FOP to support OpenType fonts?
> Jeremias,
> They are with your /GlyphDirectory mechanism, and for full font 
> embedding but not for subsetting with the /sfnts in my patch. And the 
> /GlyphDirectory system was causing issues with some printers (I think 
> IBM printers if memory serves), so it depends what you mean by 
> supported. You'll be able to view them and print them on most 
> printers, but can't guarantee 100% compliance.
> Sorry if I didn't make that clear.
> Mehdi

Reply via email to