xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Butterweck" <ralf.butterw...@ubh.de>
Subject Re: How can i do to print directly in a embedded FOP application?
Date Thu, 03 Jun 2004 13:54:34 GMT
Send reply to:  	fop-user@xml.apache.org
Date sent:      	Thu, 03 Jun 2004 14:42:37 +0200
From:           	Rudy RENTSCH <rentsch@essi.fr>
To:             	fop-user@xml.apache.org
Subject:        	How can i do to print directly in a embedded FOP application?

> Hi,
> I've an application which uses JPanel, and I embedded FOP to have the 
> possibility to print information contained in a frame.
> I followed the code provided in your example called 
> "ExampleObj2PDF.java", and I manage to transform informations in a PDF 
> file. But in the beggining, i'd like to print these information 
> directly, without generating a PDF file.
> The problem is if I specify Driver.RENDER_PRINT when I set the renderer 
> of the Driver ( by this command : 
> "driver.setRenderer(Driver.RENDER_PRINT);" ), then I obtain an error 
> indicating :
> "IllegalArgumentException : Use renderer form of setRenderer() for PRINT"
> which is normal in according to the class Driver. But if I use the 
> method "setRenderer(Renderer renderer)", I can't put a PrintRenderer 
> like parameter (abstract class)...
> Can you help me please, telling me how can I do to specify that I want a 
>   printed output?
> Thanks.
> Rudy

	with this function 'use_fop_prt' i can print directly to my standardprinter,
	but sometimes the result look a bit different to a generated PDF-file.	
	The 'fileSource' is the fo-file that was produced frpm the xml and xls-File
	a step before.
	private void use_fop_prt(String fileSrc)
	throws FileNotFoundException, IOException, FOPException
		File source;
		PrinterJob pj; 
		int copies;
		AWTRenderer renderer;
		File UserConfigFile = new File("fop/conf/userconfig.xml");
		Options op = new Options(UserConfigFile);
		source = new File (fileSrc);
		pj = PrinterJob.getPrinterJob(); 
		copies =  1;
		renderer = new AWTRenderer(pj);	               
			new File(source.getAbsolutePath()).getParentFile().toURL().toExternalForm());         

		Driver driver = new Driver(new InputSource(fileSrc), null);          
  		Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);

	Hope this helps a bit

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

View raw message