RE: Can FOP tell Acrobat Reader about wanted orientation?
Hi, Jeremais and I have been talking a while on the mailing list about this (I almost asked the same question). PDF *does not* hold any informatio about neither page orientation nor paper size. This is actually part of its (portability). You must pass the correct parameters to Acrobat so as to adjust orientation and paper size, and set them correctly in the ps file that is actually printed. Your Acrobat call would look similar to this: acroread -toPostScript -landscape -size A4 pdffile.pdf psfile.ps -Original Message- From: Henriksen Niels Kristoffer [mailto:[EMAIL PROTECTED] Sent: Thursday, June 20, 2002 12:45 PM To: '[EMAIL PROTECTED]' Subject: Can FOP tell Acrobat Reader about wanted orientation? Hi foppers! I'm using reports in the PDF format using an XSL-stylesheet on an XML-souce, using FOP-0.20.3. I will need to control the orientation of the output - for some reports I need portrait orientation, for others I need landscape. My current problem is with landscape. In my style sheet, I try to control this by setting page-width="297mm" page-height="210mm". FOP runs fine from a command line and my Adobe Acrobat Reader 5.0 displays the result in landscape. The tag is include below. However, to get the thing printed right, I currently have to MANUALLY set "Copies and Adjustment" radio buttons in the Adobe Acrobat Reader 5.0 print pop-up as follows "Shrink oversized pages to paper size" CHECKED "Expand small pages to paper size" NOT CHECKED "Auto-rotate and center pages" NOT CHECKED Thsi is higly inconvenient for our end useres. (Also I must set paper orientation to landscape in the printer properties, but I recognize that this has nothing to do with FOP). My question: assuming, that "Copies and Adjustment" settings are part of the Acrobat Reader's settings for that document, is there any way to set these settings in the style sheet and getting FOP to tell Acrobat Reader about it? Or, more general, what are the possibilities with FOP to control page orientation in the resulting PDF? Any suggestions are warmly welcomed Kind regards Niels K. Henriksen.
RE: Configuring Portrait/landscape from PSRenderer
Yes, we convert pdf to ps from the command line using Acrobat. I don't know about the printer because I'm not the one who wrote the code (that I want to get rid of) and I'm not the one who is concerned. I only know they accept PS. Anyways, it seems from your answer that if I render fo to PS directly, the code will be more dependant not only on the application (and its parameters, which I wanted to remove), but also on the printer. That's something I really don't want to do. Right now everything is fine. I only posted the questions because I wanted the code to look better (and because I wanted to understand why things must be done this way). From an OO point of view, I thought it could be better to pass to the printer (the printing object, that is) only one thing that has is all ( the document, pdf or ps) and not like what is happening now; passing also the paper size and the orientation, to be used by Acorbat. Thank you very much Jeremais -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 18, 2002 7:33 PM To: [EMAIL PROTECTED] Subject: Re: Configuring Portrait/landscape from PSRenderer > We use Acrobat on Unix to print PDF's. Currently we have to call Acrobat > with the correct parameters of paper size and orientation from Java code. I > was wondering maybe I could get rid of this step by including such > parameters into the pdf itself. It seems I can't. No. Do I get you correctly, that you convert the PDF to PS on the command line and print the resulting PS file? What printer are you printing on? We're printing on big Xerox DocuPrint printers that have no trouble with the PostScript generated by Acrobat Reader on Unix. If you're printing on a HP LaserJet or similar there might be some special PS commands available that you could patch the PS with to get what you want. > I understood from Amine's question that it is not the same case with PS (of > course, it is a printer language). I think his question meant that in PS it > is possible to set the orientation (and the paper size??) in PS. If so, I > might consider changing my output format to PS, and hence get rid of the > ugly Acrobat call, with parameters, from code. Currently I don't know if > switching to PS is that easy, or if it would work as I expect. Switching to PS may not be so easy, switching to PSRenderer that is. The PS renderer still lacks considerable features when compared to the PDF renderer. I'm still using the PDF renderer for our stuff and convert the PDFs to PostScript using Acrobat Reader on Unix. But it may be worthwhile to try it out if you only need Times, Helvetica or Courier. > It all depends on whether the paper size can be set inside the fo (probably > not?) and rendered correctly to PS using FOP. Or, possibly by using another > workaround in PSRenderer e.g. by measuring the page width/height combination > against standard paper sizes and setting the closest one into the PS. You set the paper size in the page master. And FOP does everything right what paper size is concerned. The only problem is mastering the different target printers. PDF is meant to be portable so it doesn't contain printer specific stuff. Printing a PDF means you have to do some stuff before everything prints out as expected. In PS this is currently the same, because the PS renderer doesn't support PPD's that describes the PS printer's capabilities. When you install a PostScript printer on Windows you often get the standard Adobe PS driver plus a PPD. I think the solution to your problem really depends on the printer you're using. If you can tell me which one you're using, then I can probably propose a solution. > But thanks for implementing the orientation for PS orientation anyway :) You're welcome. Cheers, Jeremias Märki
RE: Configuring Portrait/landscape from PSRenderer
Thanks Jeremais, We use Acrobat on Unix to print PDF's. Currently we have to call Acrobat with the correct parameters of paper size and orientation from Java code. I was wondering maybe I could get rid of this step by including such parameters into the pdf itself. It seems I can't. I understood from Amine's question that it is not the same case with PS (of course, it is a printer language). I think his question meant that in PS it is possible to set the orientation (and the paper size??) in PS. If so, I might consider changing my output format to PS, and hence get rid of the ugly Acrobat call, with parameters, from code. Currently I don't know if switching to PS is that easy, or if it would work as I expect. It all depends on whether the paper size can be set inside the fo (probably not?) and rendered correctly to PS using FOP. Or, possibly by using another workaround in PSRenderer e.g. by measuring the page width/height combination against standard paper sizes and setting the closest one into the PS. But thanks for implementing the orientation for PS orientation anyway :) -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 18, 2002 6:35 PM To: [EMAIL PROTECTED] Subject: Re: Configuring Portrait/landscape from PSRenderer > Is it possible to do the same thing with pdf? Yes, it is, if someone's going to implement it. Another question is if it makes sense to do this, or better: is it really necessary? I haven't investigated that, yet. I'm printing in portrait mode usually... I wonder what you're trying to do. > AFAIK pdf doesn't have info about page orientation, and as a sequence, you > have to pass the orientation to the printing application (eg acrobat) so > that it prints corectly, but I need someone to assert this info.. That's correct. PDF doesn't contain info about page orientation. > Also, the page size (A3, A4, letter, etc..), AFAIK pdf doesn't have info > about it either. so even with the right page sizes you cant configure your > pdf print application to choose the correct paper size form within the pdf. > again, you have to pass/set the page size into the application. right? The PDF contains the extent of each page (width and height) but not a paper size as in "A4" or "letter". Acrobat Reader has a lot of options in the GUI to rotate and scale a page before it is printed. The unix command line of Acrobat Reader has options that need to be set (ex. -size a4) so the page is transformed to PostScript correctly. What is your "application"? > What about formats other than ps and pdf? There are probably similar issues. Cheers, Jeremias Märki
RE: Configuring Portrait/landscape from PSRenderer
Hello all, Is it possible to do the same thing with pdf? AFAIK pdf doesn't have info about page orientation, and as a sequence, you have to pass the orientation to the printing application (eg acrobat) so that it prints corectly, but I need someone to assert this info.. Also, the page size (A3, A4, letter, etc..), AFAIK pdf doesn't have info about it either. so even with the right page sizes you cant configure your pdf print application to choose the correct paper size form within the pdf. again, you have to pass/set the page size into the application. right? What about formats other than ps and pdf? Thanks -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Monday, June 17, 2002 9:25 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Configuring Portrait/landscape from PSRenderer I've put together a code snippet for you which rotates the pages so they should come out fine on your PS printer. I've modified the PSRenderer.java from 0.20.4rc. It shouldn't be hard to adapt the changes to an older version if necessary. This is the new renderPage() method in org.apache.fop.render.ps.PSRenderer.java: public void renderPage(Page page) { this.pagecount++; this.idReferences = page.getIDReferences(); int pw = Math.round(page.getWidth() / 1000f); int ph = Math.round(page.getHeight() / 1000f); BodyAreaContainer body; AreaContainer before, after; write("%%Page: " + page.getNumber() + " " + page.getNumber()); if (page.getHeight() > page.getWidth()) { write("%%PageBoundingBox: 0 0 " + pw + " " + ph); write("%%PageOrientation: Portrait"); } else { write("%%PageBoundingBox: 0 0 " + ph + " " + pw); write("%%PageOrientation: Landscape"); } write("%%BeginPageSetup"); write("FOPprocs begin"); write("FOPFonts begin"); if (page.getHeight() < page.getWidth()) { write("90 rotate"); write("0 -" + ph + " translate"); } write("0.001 0.001 scale"); write("%%EndPageSetup"); body = page.getBody(); before = page.getBefore(); after = page.getAfter(); if (before != null) { renderAreaContainer(before); } renderBodyAreaContainer(body); if (after != null) { renderAreaContainer(after); } write("showpage"); write("%%PageTrailer"); write("%%EndPage"); //This is non-standard, but used by Adobe. } I won't commit this change before the final release of 0.20.4, so you'll have to patch your code until then. Since this changes the sematics of the PS renderer I will make some further modifications to make this configurable. Tell me if this worked for you. And as payment for my service I'd like to know what printer you're going to print on. :-) On 17.06.2002 09:52:35 Amine AMAR wrote: > Thank's for the answer, but i want to control the printer so that it does > print in landscape. when changing the page height and width, the printer > still prints in portait ! Cheers, Jeremias Maerki
RE: FOP vs. Actuate Java Edition
Hello, Yes, we had some experience with Actuate and it was.. BAD Actually we used version 4.1, used to be called ERW, but we also tested version 5 and we had the same problems First, the one that really had us change to FOP (after wasting money on Actuate), text inside Actuate produced table cells DOES NOT WRAP. The text is simply written on the neighbor cells Also, when the data source for the report is the application not the database directly, it is very difficult to program it. You'll get very frustrated having to create lots of Interfaces, ... You'll also have to launch the Actuate application from your own code in order to create the report templates, you will not be able to use it directly as an API to crate such templates (or use another standard tool, e.g. and XSL editor like in FOP). A job that will NOT be funny As for FOP (XSLT/XSLFO combination) You not only get the maximum flexibility and the standardization, but the performance is actually very good. You also have the ease and flexibility to get the data in the form of XML the way you want it (quite a lot of XML api's/tools out there. Want my advice: Go directly for XML/XSLT/XSLFO/FOP and save your company's money -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 12, 2002 2:57 PM To: [EMAIL PROTECTED] Subject: FOP vs. Actuate Java Edition Hello all, Recently we had a sales demo of the Actuate Java Edition reporting tool. The tool provides a Swing interface to assist in formatting the layout, and it also can connect to RDBMS data sources to provide drag-n-drop additions of report data elements. We're currently planning on using an FOP-based solution for our reporting needs. We built a fairly optimized FOP architecture which performs well -- complex PDF pages are rendered at the rate of approximately 2 pages per second on an Intel 750 MHz box. Question: Does anybody out there have any experience with the Actuate Java Edition tool? The GUI format designer would be nice, but I'm guessing notY as flexible as using XSL stylesheets as in FOP. Also, would it perform better than the FOP, as in being faster or using less memory? I know the Actuate tool can provide a table of contents, which is known to cause problems when using FOP -- but I don't know if the Actuate tool suffers the same problem (sales demos use small reports). Any insight is greatly appreciated. -Ryan
Table alignment
Hello all, I know this is a FAQ but I don't have the optimum solution yet I want to align a table, whose width is smaller than the body width, to be in the center of the page body I think I read a solution before on this list, suggesting to put the table inside the cell of another one-cell table, but I don't know which attribute to use and on which element. BTW I'm stuck to version 0.17.0 of FOP Thanks a lot
RE: Building a FO document with FOP
Thanks All, I'm well aware of the XSL solution. We had long discussions about the subject of using XSL on XML documents. I'd say I'm forced for the time being to write the pure FO directly through code. I'd like to know if anyboy actually has some experience with writing FO through code. I'd also like to know if I can use the FObj and its decendants (available in the FOP source codebase) to write FO documents and whether or not this is favored to writing the FO docuemnts, using code also, but as an ordinary XML document. Best -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 30, 2002 5:50 PM To: [EMAIL PROTECTED] Subject: Re: Building a FO document with FOP I recommend you don't build XSL:FO through Java code directly. Produce a simple XML format with just the data in it. Use a XSLT stylesheet afterwards to convert the XMl to XSL:FO. It sounds like a lot of work, but you're actually going to save time. For example, if your layout has to change you have to adjust your Java code, recompile, redeploy. If you're working with XSLT you can use some external XML tool, and you just have to switch the stylesheet if something changes in the layout. The whole idea about XSL (XSLT+XSL:FO) is separation of data/layout. You will be a lot more flexible that way! Just imagine you want to generate HTML or SVG instead of XSL:FO. This way, you (only) have to switch stylesheets. Your way means writing the Java classes that produce the XML all over again. > This is not exactly what I mean. I don't have XML data documens, I'm trying > to build a pure XSL:FO document through code, not transform an existing XML > to FO. It will go like this: > Data (from DB) --(Java code)--> FO document --(render with FOP)--> PDF > > Any clue? > > -Original Message- > From: Katiyar, Bhawana [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 30, 2002 5:05 PM > To: [EMAIL PROTECTED] > Subject: RE: Building a FO document with FOP > > > I guess it is better to build them as XML documents and use xsl:fo to > transform them to FO documents. It is much easier. You could use the XML to > render HTML, RTF or any other format. FOP programming is also much easier, > as you shift all the java programming burden of building the FO document to > FOP. > Bhawana > > -Original Message- > From: Ismaeil, Sameh Z [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 30, 2002 10:37 AM > To: '[EMAIL PROTECTED]' > Subject: Building a FO document with FOP > > > Hello All, > > We are trying to build FO documents through Java code, these documents will > be rendered with FOP. I would like to know whether it is recommended to > build them using the FOP classes that represent FO elements (FONode/FObj and > its decendants), or whether it is better to build them as XML docuemnts and > use FOP for rendering only. Cheers, Jeremias Märki mailto:[EMAIL PROTECTED] OUTLINE AG Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern Tel. +41 41 317 2020 - Fax +41 41 317 2029 Internet http://www.outline.ch
RE: Building a FO document with FOP
Thanks Bhawana, This is not exactly what I mean. I don't have XML data documens, I'm trying to build a pure XSL:FO document through code, not transform an existing XML to FO. It will go like this: Data (from DB) --(Java code)--> FO document --(render with FOP)--> PDF Any clue? -Original Message- From: Katiyar, Bhawana [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 30, 2002 5:05 PM To: [EMAIL PROTECTED] Subject: RE: Building a FO document with FOP I guess it is better to build them as XML documents and use xsl:fo to transform them to FO documents. It is much easier. You could use the XML to render HTML, RTF or any other format. FOP programming is also much easier, as you shift all the java programming burden of building the FO document to FOP. Bhawana -Original Message----- From: Ismaeil, Sameh Z [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 30, 2002 10:37 AM To: '[EMAIL PROTECTED]' Subject: Building a FO document with FOP Hello All, We are trying to build FO documents through Java code, these documents will be rendered with FOP. I would like to know whether it is recommended to build them using the FOP classes that represent FO elements (FONode/FObj and its decendants), or whether it is better to build them as XML docuemnts and use FOP for rendering only. Thanks in advance
Building a FO document with FOP
Hello All, We are trying to build FO documents through Java code, these documents will be rendered with FOP. I would like to know whether it is recommended to build them using the FOP classes that represent FO elements (FONode/FObj and its decendants), or whether it is better to build them as XML docuemnts and use FOP for rendering only. Thanks in advance