xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Hancock <peter.hanc...@gmail.com>
Subject Re: FOP 0.95 printing
Date Tue, 23 Mar 2010 12:37:47 GMT
Hi Eric,

You will have to compile FOP trunk yourself I am afraid.  It is straight
forward but requires you to have ant installed.  From the FOP trunk checkout
dir you can just run 'ant' from the command line and it will build the Fop
jars for you. For more details see
http://xmlgraphics.apache.org/fop/0.95/compiling.html

I am not really sure how FOP auto loads fonts from the font base url, or
which renders support it.

Pete

On Tue, Mar 23, 2010 at 12:20 PM, Eric Douglas <edouglas@blockhouse.com>wrote:

>  Hi Pete,
>
> I may just need to look at this again, and maybe I missed something the
> first time.  I'll look for that example and see if that helps.  I was trying
> to use java.awt.PrinterJob but it can't doing anything until I transform,
> and the transform method was sending output to the printer, so I couldn't
> quite figure out where to specify which printer to use.
>
> I am embedding the code, not in Java but in a secondary language which is
> able to include any Java code with slightly different syntax.  It is also
> able to call Java code if there's anything which needs to be written in Java
> that it can't emulate.
>
> I did run into some difficulties trying to code the same output to 3
> different formats (screen, PDF, printer) since they require different
> renderers which are in different paths.  I see the SVGRenderer,
> TIFFRenderer, AWTRenderer, PrintRenderer, PNGRenderer, and a
> PNGRenderer_onthefly are subclasses of Java2DRenderer while PSRenderer and
> PDFRenderer are not.
>
> I would like to print using specific fonts from specific TTF files.  I
> don't want to rely on the fonts being installed in the OS on the machine
> running the application.  We did that in the past and ran into a problem
> where someone's OS didn't have the font or someone had a different version
> of the same font and they got different output.  I'm finding it difficult in
> FOP to connect my custom font to the different renderers.  I added the font
> references in the fop.xconf file.  The AWTRenderer seems to find it just
> fine with the FopFactory.setFontBaseURL method while the PDFRenderer
> doesn't.  The PDFRenderer seems to find the font correctly if I add a block
> of code using the TTFFontLoader to create an EmbedFontInfo with the xml
> metrics generated by FOP, passing it into the setFontList, but the font size
> comes out different than the AWTRenderer.
>
> How do I upgrade to the Trunk?  I didn't see a compiled download.  I
> believe I found a source download for it, but I'm not sure how to compile
> it.
>
>  ------------------------------
> *From:* Peter Hancock [mailto:peter.hancock@gmail.com]
> *Sent:* Tuesday, March 23, 2010 6:04 AM
> *To:* fop-users@xmlgraphics.apache.org
> *Subject:* Re: FOP 0.95 printing
>
> Hi Eric,
>
> Do you run FOP standalone from the command line, or do you embed it in your
> own app?  The reason I ask is because the example
> embedding.ExampleFO2OldStylePrint.java in examples/embedding/java of the FOP
> 0.95 source illustrates the minimal utility of  java.awt.print.PrinterJob
> for printing, and you may be able to adapt it for your own needs.  I am not
> familiar with PrinterJob but I am guessing it can be configured with your
> printer destination etc.
>
> The FOP docs are a little minimal see:
> http://xmlgraphics.apache.org/fop/0.95/output.html#print
> http://xmlgraphics.apache.org/fop/0.95/fonts.html#awt
>
> They do explain that the available fonts are those configured on your OS,
> and that PrintRenderer uses java2D to create the output.
>
> I briefly took a look at the trunk code, and I do notice any functional
> improvements made to the PrintRenderer.  However, upgrading your version of
> FOP from 0.95 to trunk is recommenced if possible.
>
> I hope some of this helps!
>
> Pete
>
> On Mon, Mar 22, 2010 at 7:52 PM, Eric Douglas <edouglas@blockhouse.com>wrote:
>
>>  How do I set up FOP 0.95 for printing a custom font?
>> I have a truetype font file and it works fine printing to PDF or a preview
>> window, but I can't get it to print directly to the printer.
>>
>> If I use the PrintRenderer I can't figure out a way to tell it which
>> printer to print to.
>> If I use the PSRenderer it finds the right printer but of course it
>> doesn't work (yet?) with truetype fonts.
>> I don't seem to have a valid Type 1 font file and I don't know how I can
>> create one or where I could download one (free).
>>
>
>

Mime
View raw message