Thank you for the reply.

What I would really like to do is to bypass the XML input that FOP normally 
uses and call the FOP Java methods from our framework directly in order to 
produce a PostScript file.  Checking examples online I didn’t have a 
configuration file.  I’m thinking now that I need one to define the fonts.  At 
this point I am just trying to get 1 line of text to come out in the PS file.  
Here is my code.

                              OutputStream output = new 
FileOutputStream("C:/snapshotviews/sts-workspace-3.7/billing-document-system/bds-service/src/test/resources/Products/Paper/xmlgraphicsTest.ps");
                              PSGenerator psGenerator = new PSGenerator(output);
                              // Setup
                              FopFactory fopFactory = 
FopFactory.newInstance(new File(".").toURI());
                              FOUserAgent foUserAgent = 
fopFactory.newFOUserAgent();
                              IFContext context = new IFContext(foUserAgent);
                              PSDocumentHandler psDocumentHandler = new 
PSDocumentHandler(context);
                              // Stuff the Fonts in the class
FontInfo fontInfo = new FontInfo();
fontInfo.addFontProperties("header", "Helvetica", "normal", 0);
psDocumentHandler.setFontResources(fontInfo);
psDocumentHandler.setFontInfo(fontInfo);
                              psDocumentHandler.setGenerator(psGenerator);
                              // Create the top of the PostScript file
                              psDocumentHandler.endDocumentHeader();
                              // Loop through the pages
                              PSPainter ifPainter = 
psDocumentHandler.startPageContent();
                              // Set up the font for the text
                              IFState ifState = IFState.create();
                              ifState.setFontFamily("Helvetica");
                              ifState.setFontStyle("normal");
                              ifState.setFontWeight(0);
                              ifState.setFontSize(10);
                              ifState.setTextColor(Color.BLACK);
                              ifPainter.setState(ifState);
                              // Write the text to the PostScript file
                              ifPainter.drawText(100, 500, 2, 5, null, "PDF 
Text");

                              // Wrap up
                              psGenerator.flush();
                              output.flush();
                              output.close();

Thank you,
Ray

From: Szeak (Register Man) [mailto:szea...@gmail.com]
Sent: Tuesday, August 30, 2016 1:41 AM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Need help calling FOP correctly

Hi,

We need more info about how do you using FOP. What is in FOP config?
Can you show us your used config, and small piece from your code which loads or 
sets the config?

2016-08-29 22:51 keltezéssel, Clark, Raymond C írta:
Hi all,

At work we have a Java framework that I need to hook in with FOP.  So I need 
our framework to call the appropriate FOP classes.methods to produce a 
PostScript file.  I have it producing a PostScript file but I am having trouble 
with fonts.

What do I need to call to get a font, Helvetica or Times New Roman, etc, loaded 
into PSDocumentHandler correctly so that when I call PSPainter.drawText the 
text appears in the PostScript file?  Right now I am getting the Font not 
available exception.

Thank you,
Ray

________________________________

CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are 
intended solely for the use of the individual or entity to whom they are 
addressed and may contain confidential and privileged information protected by 
law. If you received this e-mail in error, any review, use, dissemination, 
distribution, or copying of the e-mail is strictly prohibited. Please notify 
the sender immediately by return e-mail and delete all copies from your system.



--------------------------------------------------------------------- To 
unsubscribe, e-mail: 
fop-users-unsubscr...@xmlgraphics.apache.org<mailto:fop-users-unsubscr...@xmlgraphics.apache.org>
 For additional commands, e-mail: 
fop-users-h...@xmlgraphics.apache.org<mailto:fop-users-h...@xmlgraphics.apache.org>

Reply via email to