xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reyal <real050...@gmail.com>
Subject Printing in FOP using PageableRenderer with Unicode characters
Date Fri, 03 Apr 2009 02:44:39 GMT

Good day,

I tried to follow this thread here.
http://www.nabble.com/Direct-Printing-and-setting-print-parameters-in-FOP-0.94-tp16747594p22087146.html

I also build my own copy from fop-trunk for my testing and
use your example. The printing looks cool but still got a warning when
using barcode and thai characters. The printed output have no barcode
and thai characters in it. What I mean is that the fonts were not applied.

Below is the code snippet:
public void printFO(File fo) throws IOException, FOPException,
			TransformerException, PrintException {

		// Set up DocPrintJob instance
		DocPrintJob printJob = createDocPrintJob();
		// Set up a custom user agent so we can supply our own renderer instance
		FOUserAgent userAgent = fopFactory.newFOUserAgent();
		
		PageableRenderer renderer = new PageableRenderer();
		renderer.setUserAgent(userAgent);
		userAgent.setRendererOverride(renderer);

		// Construct FOP with desired output format
		Fop fop = fopFactory.newFop(userAgent);
		try {
			fopFactory.setUserConfig(new File("xml/fopConf.xml"));
		} catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		// Setup JAXP using identity transformer
		TransformerFactory factory = TransformerFactory.newInstance();
		Transformer transformer = factory.newTransformer(); // identity
															// transformer

		// Setup input stream
		Source src = new StreamSource(fo);

		// Resulting SAX events (the generated FO) must be piped through to FOP
		Result res = new SAXResult(fop.getDefaultHandler());

		// Start XSLT transformation and FOP processing
		transformer.transform(src, res);

		Doc doc = new SimpleDoc(renderer, DocFlavor.SERVICE_FORMATTED.PAGEABLE,
				null);
		printJob.print(doc, null);
	}

------------[fopConf.xml]-------------------------
<?xml version="1.0"?>
<fop version="1.0">

  <!-- Base URL for resolving relative URLs -->
  <base>.</base>
  
  <!-- Font Base URL for resolving relative font URLs -->
  <font-base>./</font-base>
  <renderers>
     <renderer mime="application/X-fop-print">
      <fonts>
        <directory recursive="true">D:/PRINTING</directory>
        
          <font-triplet name="Barcode" style="normal" weight="normal"/>
        
                
        
          <font-triplet name="Thai" style="normal" weight="normal"/>
        
      </fonts>
    </renderer>
  </renderers>
</fop>

When I run the above, I got the warning messages below:

Apr 3, 2009 10:27:23 AM org.apache.fop.events.LoggingEventListener
processEvent
WARNING: Font "Barcode,normal,700" not found. Substituting with
"any,normal,700".
Apr 3, 2009 10:27:23 AM org.apache.fop.events.LoggingEventListener
processEvent
WARNING: Line 1 of a paragraph overflows the available area by 29345
millipoints. (See position 697:49)
Apr 3, 2009 10:27:23 AM org.apache.fop.events.LoggingEventListener
processEvent
INFO: An fo:block  (See position 708:30) is wider than the available room in
inline-progression-dimension. Adjusting end-indent based on overconstrained
geometry rules (XSL 1.1, ch. 5.3.4)
Apr 3, 2009 10:27:23 AM org.apache.fop.events.LoggingEventListener
processEvent
INFO: An fo:block  (See position 730:30) is wider than the available room in
inline-progression-dimension. Adjusting end-indent based on overconstrained
geometry rules (XSL 1.1, ch. 5.3.4)
Apr 3, 2009 10:27:23 AM org.apache.fop.events.LoggingEventListener
processEvent
WARNING: Font "Thai,normal,400" not found. Substituting with
"any,normal,400".
Success!

Any help?

-
Rey
-- 
View this message in context: http://www.nabble.com/Printing-in-FOP-using-PageableRenderer-with-Unicode-characters-tp22860872p22860872.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message