Fitting data of a table into A4 size
Dear FOP experts: I'm now building an application that generate report in PDF format. I'm using FOP. A requirement of report format is all report data must fit into a PDF page (A4 for example) in both vertical and horizontal sides. This is my solutions: We calulate maximum number of characters on a line in horizontal side, number of line in vertical side, after that we calculate the width and the height of a character and calculate the font size follow these width and height. Could you have an idea about this issue or suggest another solution? Best regards, Hiennt
gain memory
Hello! I would like to improve the code below 2 questions: - java says to me that input.getParser() input.getInputSource() are deprecated what is necessary to use in the place ? - to gain memory, are my files well closed? --- XSLTInputHandler input = new XSLTInputHandler(new File(xml),new File(xsl)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Driver driver = new Driver(); driver.setLogger(loggerFop); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); driver.render(input.getParser(),input.getInputSource()); byte[] content = out.toByteArray(); FileOutputStream fos = new FileOutputStream(pdf); fos.write(content);
Re: Running junit tests fails
Simon Pepping wrote: When I try to run the junit tests on the code checked out from CVS HEAD, I get a failure because ant cannot create task or type of type: junit. I do not know anything about junit. I had hoped this target would run out of the box. snip/ BUILD FAILED file:/fsd/source/xml-fop/build.xml:659: Could not create task or type of type: junit. Ant could not find the task or a class this task relies upon. junit is version 3.8.1. I get the same thing, but I also dont know how to solve it. Looking in the build.xml doesnt reveal any *obvious* dependencies for junit that are missing. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
BUILD FAILED file:/fsd/source/xml-fop/build.xml:659: Could not create task or type of type: junit. Ant could not find the task or a class this task relies upon. junit is version 3.8.1. I get the same thing, but I also dont know how to solve it. Looking in the build.xml doesnt reveal any *obvious* dependencies for junit that are missing. You may want to add the jar containing the junit task in the JUNIT_HOME/lib directory. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stan Pinte. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
Stan Pinte wrote: You may want to add the jar containing the junit task in the JUNIT_HOME/lib directory. Whats the name of the jar containing the junit ant task definition then? Ive added the junit.jar, there is also a test.jar and a src.jar in my junit directory (no lib sub dir though!) The junit.present condition in the build.xml file doesnt let you procced without the junit.jar. However, I'm not sure if junit.jar contains the ant task definition. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
On Wed, 10 Dec 2003 11:44:08 +, Chris Bowditch [EMAIL PROTECTED] wrote: Stan Pinte wrote: You may want to add the jar containing the junit task in the JUNIT_HOME/lib directory. Whats the name of the jar containing the junit ant task definition then? Ive added the junit.jar, there is also a test.jar and a src.jar in my junit directory (no lib sub dir though!) The junit.present condition in the build.xml file doesnt let you procced without the junit.jar. However, I'm not sure if junit.jar contains the ant task definition. I don't know, you may want to submit that to the junit list. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stan Pinte. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
junit.jar is sufficient. The jar should be placed in %ANT_HOME%/lib. Use JUnit 3.8.1 or later to be sure. The JUnit task is included in Ant's optional.jar but only works if junit.jar is present in %ANT_HOME%/lib. Actually, I don't understand why the JUnit suport is recognized but the test cases don't work. On 10.12.2003 12:44:08 Chris Bowditch wrote: Whats the name of the jar containing the junit ant task definition then? Ive added the junit.jar, there is also a test.jar and a src.jar in my junit directory (no lib sub dir though!) The junit.present condition in the build.xml file doesnt let you procced without the junit.jar. However, I'm not sure if junit.jar contains the ant task definition. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with .fo file
Hello people, I'm having trouble with a .fo file. I'm able to convert it to PDF when using the command line, but when I try to print it (using awt) thanks to embedded code, I have this error : [INFO,Default] [PrintDocument][setupFopAndRender] loading and printing XSL-FO document file:/C:/JBoss-2.4.4_Tomcat-3.2.3/properties/JO.fo [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser [INFO,Default] [INFO] [INFO,Default] building formatting object tree [INFO,Default] [INFO] [INFO,Default] setting up fonts [ERROR,Default] org.apache.fop.apps.FOPException: Error while attempting to print document, root cause : Document root element is missing. Here is the sniplet of code I use : ... public void setupFopAndRender(String documentSource) throws FOPException, IOException { PrinterJob aPrinterJob = PrinterJob.getPrinterJob(); PrintRenderer aPrintRenderer = new PrintRenderer(aPrinterJob); URL anURL = ClassLoader.getSystemResource(documentSource); System.out.println([PrintDocument][setupFopAndRender] loading and printing XSL-FO document + anURL.toString()); if (anURL == null) throw new IOException(XSL-FO file could not be found.\n Check for its presence in the classpath); InputStream anInputStream = anURL.openStream(); Options options = new Options(userConfigFile); Driver FOPDriver = new Driver(new InputSource(anInputStream), null); Logger FOPLogger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO); MessageHandler.setScreenLogger(FOPLogger); FOPDriver.setLogger(FOPLogger); FOPDriver.setRenderer(aPrintRenderer); renderFop(FOPDriver); anInputStream.close(); } private synchronized void renderFop(Driver FOPDriver) throws IOException, FOPException { FOPDriver.run(); } What am I missing ? What's wrong with my document ? Thanks for any help Fredéric Kieffer Attached are the .fo file, and it's pdf jo.pdf Description: Binary data JO.fo Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
On Wed, 10 Dec 2003 14:28:23 +0100, Jeremias Maerki [EMAIL PROTECTED] wrote: junit.jar is sufficient. The jar should be placed in %ANT_HOME%/lib. sorry for my mistake... Use JUnit 3.8.1 or later to be sure. The JUnit task is included in Ant's optional.jar but only works if junit.jar is present in %ANT_HOME%/lib. Actually, I don't understand why the JUnit suport is recognized but the test cases don't work. On 10.12.2003 12:44:08 Chris Bowditch wrote: Whats the name of the jar containing the junit ant task definition then? Ive added the junit.jar, there is also a test.jar and a src.jar in my junit directory (no lib sub dir though!) The junit.present condition in the build.xml file doesnt let you procced without the junit.jar. However, I'm not sure if junit.jar contains the ant task definition. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Stan Pinte. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: gain memory
Please use the JAXP standard instead of the XSLTInputHandler wrapper. Look at the ExampleXML2PDF.java in: http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ Glen --- Philippe PITHON [EMAIL PROTECTED] wrote: Hello ! I would like to improve the code below 2 questions : - java says to me that input.getParser() input.getInputSource() are deprecated what is necessary to use in the place ? - to gain memory, are my files well closed? --- XSLTInputHandler input = new XSLTInputHandler(new File(xml),new File(xsl)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Driver driver = new Driver(); driver.setLogger(loggerFop); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); driver.render(input.getParser(),input.getInputSource()); byte[] content = out.toByteArray(); FileOutputStream fos = new FileOutputStream(pdf); fos.write(content); __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem with positioning of fo:block-container
Hello! I'm using fop 0.25 for quite complex design and output to pdf. i had some problems which i managed to solve, but one remains : in some files, fop has problem with element fo:block-container and positioning it on X axis. I mean - i have several fo:block-container elements with the same value in left attribute and different values in top attribute. One or more (smaller part of all) are rendered rather strange - x position of the block-container is badly shifted to right. i found solution - to manually change the order of the fo:block-container elements. but it sometimes results to shifting another fo:block-containers. is this known problem for fop 0.25? i need it for rather big project - i think it would be really good testing for fop .. :) ps: i have another problem, which i managed to solve, but i do not like my solution :). i have this piece of code : fo:block fo:inline font-family="arial"a/fo:inline fo:inline font-family="courrier"b/fo:inline fo:inline font-family="arial"c/fo:inline fo:inline font-family="courrier"d/fo:inline /fo:block is there any way to get 'a' 'b' 'c' 'd' to render on one line? i mean, without putting all fo:inline on the same line (i have looong lines), like this: fo:blockfo:inline font-family="arial"a/fo:inlinefo:inline font-family="courrier"b/fo:inline... when i tried to use inline-container, nothing was rendered. my solution is something like this: fo:block font-family="arial" afo:inline font-family="courrier"b/fo:inlinecfo:inline font-family="courrier"d/fo:inline /fo:block thanx for anything. Ing. Michal Bachork, Product Specialist email: [EMAIL PROTECTED] phone: +421 903 43 43 46 Exprit s.r.o., Jilemnickho 2 911 01 Trenn SLOVAKIA
problem with positioning of fo:block-container
Return Receipt Your problem with positioning of fo:block-container document : was Jeff Mitchell/SuppSvcs/Access received by: at: 12/10/2003 01:10:53 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Minimising FOP Runtimes
I have been working on creating a three tier system that per client requests gets data from a database, pumps this into a PDF via FOP XSL/XML processing, then sends the resulting PDF back to the client for display. This project is reaching its end and creating a 3 or 4 page document usually takes 4 or 5 seconds (this is just the FOP processing aspect). Now this is acceptable but there is no harm in hunting down speed improvements. Having read through (and implemented any relevant suggestions) the FOP documentation regarding speed, I thought it would also be a good idea to speak to the people that use this application on a daily basis, as experience is invaluable when it comes to this type of thing. Regards Manuel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
On Wed, Dec 10, 2003 at 02:28:23PM +0100, Jeremias Maerki wrote: junit.jar is sufficient. The jar should be placed in %ANT_HOME%/lib. Use JUnit 3.8.1 or later to be sure. The JUnit task is included in Ant's optional.jar but only works if junit.jar is present in %ANT_HOME%/lib. Actually, I don't understand why the JUnit suport is recognized but the test cases don't work. junit-3.8.1.jar is the lib subdirectory of the checked out distribution. The build script declares this directory to be ANT_HOME. When I put the junit jar file there, the JUnit support was recognized. The build script does not add the junit jar file to the LOCALCLASSPATH. But when I did that it made no difference. Ant's failure message mentions optional.jar. I do not have that because it does not come with the checkout. Could that be the cause? I run Sun's java version 1.4.2_01 on linux. On 10.12.2003 12:44:08 Chris Bowditch wrote: Whats the name of the jar containing the junit ant task definition then? Ive added the junit.jar, there is also a test.jar and a src.jar in my junit directory (no lib sub dir though!) The junit.present condition in the build.xml file doesnt let you procced without the junit.jar. However, I'm not sure if junit.jar contains the ant task definition. Jeremias Maerki Regards, Simon -- Simon Pepping email: [EMAIL PROTECTED] home page: http://www.leverkruid.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Running junit tests fails
Looks like it. Please download the latest Ant release and install it following Ant's installation instructions. Then use ant.bat/ant.sh to build FOP and not build.bat. Ant can be found at http://ant.apache.org. I've heard that best practice is not to bundle Ant with a project but to make an Ant installation a requirement on every machine someone wants to build Java projects on. Looks like we hit one of the reasons for this best practice here. I'll raise that point on fop-dev. Sorry for the trouble caused. I was the one to introduce JUnit tests in the build.xml for HEAD. On 10.12.2003 20:46:52 Simon Pepping wrote: Ant's failure message mentions optional.jar. I do not have that because it does not come with the checkout. Could that be the cause? Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Minimising FOP Runtimes
Manuel Reyes wrote: I have been working on creating a three tier system that per client requests gets data from a database, pumps this into a PDF via FOP XSL/XML processing, then sends the resulting PDF back to the client for display. This project is reaching its end and creating a 3 or 4 page document usually takes 4 or 5 seconds (this is just the FOP processing aspect). Now this is acceptable but there is no harm in hunting down speed improvements. Having read through (and implemented any relevant suggestions) the FOP documentation regarding speed, I thought it would also be a good idea to speak to the people that use this application on a daily basis, as experience is invaluable when it comes to this type of thing. A time of 4 to 5 seconds for a 3..4 page document is very slow for modern machines. - Check for warm-up times. It may pay off to reuse the driver object. - Check JVM memory settings. - If the time includes XSLT, check without it. There are people out there capable of writing *horribly* inefficient XSLT. - Invest in a profiler. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with positioning of fo:block-container
Bachork Michal wrote: in some files, fop has problem with element fo:block-container and positioning it on X axis. I mean - i have several fo:block-container elements with the same value in left attribute and different values in top attribute. One or more (smaller part of all) are rendered rather strange - x position of the block-container is badly shifted to right. i found solution - to manually change the order of the fo:block-container elements. but it sometimes results to shifting another fo:block-containers. This may be due to inherited margin settings. Be sure to placeabsolutely positioned block containers only as immediate children of the flow, and that there are no margins set on the flow element. I also have reasons to believe that asbolutely positioned block containers don't mix well with footnotes. i have another problem, which i managed to solve, but i do not like my solution :). i have this piece of code : fo:block fo:inline font-family=ariala/fo:inline fo:inline font-family=courrierb/fo:inline fo:inline font-family=arialc/fo:inline fo:inline font-family=courrierd/fo:inline /fo:block is there any way to get 'a' 'b' 'c' 'd' to render on one line? There is no reason why it won't be rendered on one line. If you mean you don't want the whitespace between a and b and so on, then no, there is no way to do this without keeping the line breaks out of the text content. when i tried to use inline-container, nothing was rendered. This element isn't implemented. There is an error logged, and the content is dropped. I also don't think it would help with your problem if it was implemented. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with .fo file
[EMAIL PROTECTED] wrote: I'm able to convert it to PDF when using the command line, but when I try to print it (using awt) thanks to embedded code, I have this error : ... [INFO,Default] Using org.apache.crimson.parser.XMLReaderImpl as SAX2 Parser ... [ERROR,Default] org.apache.fop.apps.FOPException: Error while attempting to print document, root cause : Document root element is missing. The FO document has a BOM at the start. Some old versions (or even all) of the Crimson parser are confused by this. What JVM/run time environment are you using? Check whether you can enforce using a recent Xerces release as XML parser (there are plenty of instructions for everything on the net). J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Minimising FOP Runtimes
On Wed, 2003-12-10 at 18:42, J.Pietschmann wrote: Manuel Reyes wrote: I have been working on creating a three tier system that per client requests gets data from a database, pumps this into a PDF via FOP XSL/XML processing, then sends the resulting PDF back to the client for display. This project is reaching its end and creating a 3 or 4 page document usually takes 4 or 5 seconds (this is just the FOP processing aspect). Now this is acceptable but there is no harm in hunting down speed improvements. Having read through (and implemented any relevant suggestions) the FOP documentation regarding speed, I thought it would also be a good idea to speak to the people that use this application on a daily basis, as experience is invaluable when it comes to this type of thing. A time of 4 to 5 seconds for a 3..4 page document is very slow for modern machines. - Check for warm-up times. It may pay off to reuse the driver object. - Check JVM memory settings. - If the time includes XSLT, check without it. There are people out there capable of writing *horribly* inefficient XSLT. - Invest in a profiler. I definitely agree with that. Generate the '.fo' separately, say with command-line Xalan and then generate your PDF with command-line Fop. This may take more resources than a 'pipeline' approach like Cocoon but will tell you which step is more expensive. You will need to do this anyway if you wish to run a profiler. Has anyone tried CatchXSL at www.xslprofiler.org ? It seems to work and has a nice UI but I didn't grok it in the few minutes I played with it. (I suppose one could intentionally write some bad XSL to demonstrate the use of this tool.) Check your 'java' command. There are two versions of the JVM available(on professional OS's anyway) which are selectable as 'java -server' and 'java -client' respectively. I found a benefit of about 10% from the -server version. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- John Austin [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]