APACHE FOP RTF TO PDF
Is it possible to print XLS, HTML, or RTF reports using Apache FOP? If not, is there another open source or free print server that will do this?. “JFOR, an open source XSL-FO to RTF converter has been integrated into Apache FOP. This will create an RTF (rich text format) document that will attempt to. FOP can render to PDF as well as SVG, PS, RTF. The result of rendering with default font. Mar 22, AM
|Published (Last):||21 July 2013|
|PDF File Size:||12.90 Mb|
|ePub File Size:||10.82 Mb|
|Price:||Free* [*Free Regsitration Required]|
FOP supports multiple output formats by using a different renderer for each format. The renderers do not all have the same set of capabilities, sometimes because of the output format itself, sometimes because some renderers get more development attention than others. This can result in several differences, including actually using different fonts, and having different font metrics for the same font. The net effect is that the layout of a given FO document can be quite different between renderers that do not use the same font information.
Apache™ FOP Output Formats
However, you can also send output from the Postscript renderer directly to a Postscript device, or output from the PCL renderer directly to a PCL device.
PDF is the best supported output format. It is also the most accurate with text and layout. This creates a PDF document that is streamed out as each page is rendered. This means that the internal page index information is stored near the end of the document. The PDF version supported is 1. These fonts, or suitable substitute fonts with the same metrics, are guaranteed to be available in all PDF viewer applications. XMP metadata and watermarks.
One workaround is to use Adobe Acrobat the full version, not the Reader to process the file manually or with scripting that it supports. Another popular post-processing tool is iTextwhich has tools for adding security features, document properties, watermarks, and many other features to PDF files. However the principles for using iText for other PDF features are similar. Check the iText tutorial and documentation for setting access flags, password, encryption strength and other parameters.
In addition to the PDF Post-processing options, consider the following workarounds:. The PostScript renderer has been brought up to a similar quality as the PDF renderer, but may still be missing certain features. It provides good support for most text and layout. Images and SVG are not fully supported, yet.
The default value for the “auto-rotate-landscape” setting is “false”. Setting it to “true” will automatically rotate landscape pages and will mark them as landscape. The default value for the “language-level” setting is “3”. Set this to “2” only if you don’t have a Level 3 capable interpreter.
The default value for the “optimize-resources” setting is “false”. Setting it to “true” will produce the PostScript file in two steps. A temporary file will be written first which will then be processed to add only the fonts which were really used and images are added to the stream only once as PostScript forms.
This will reduce file fo; but can potentially increase the memory needed in the interpreter to process.
It should produce output as close to identical as possible to the printed output of the PDFRenderer within the limitations of the renderer, and output device. PCL 5 is used for text, raster graphics and rectangular fill graphics. The default value for the “rendering” setting is “speed” which causes borders to be painted as plain rectangles.
In this mode, no special borders dotted, dashed etc. If you want support for all border modes, set the value to “quality” as indicated above. This will cause the borders to be painted as bitmaps. The default value for the “text-rendering” setting is “auto” which paints the base fonts using PCL fonts. Non-base fonts are painted as bitmaps through Java2D. If the mix of painting methods results in unwelcome output, you can set this to “bitmap” which causes all text to be rendered as bitmaps.
The actual value will be rounded up to the next supported PCL resolution. Currently, only and dpi are supported which should be enough for most use cases. Note that this setting directly affects the size of the output file and the print quality. To use the extensions the appropriate namespace must be declared in the fo: The page-source extension attribute on fo: Not all PCL printers support the same paper trays.
Usually, “1” is the default tray, “2” is the manual paper feed, “3” is the manual envelope feed, “4” is the “lower” tray and “7” is “auto-select”. Consult the technical reference for your printer for all available values. The AFP Renderer requires special configuration particularly related to fonts. An outline font configuration is simpler as the individual font size entries are not required. However, the characterset definition is now required within the afp-font element.
Experimentation has shown that the font metrics for the FOP built-in Base14 fonts are actually very similar to some of the IBM outline and raster fonts. In cases were the IBM font files are not available the path attribute in the afp-font element can be replaced by a basefont attribute giving the name of the matching Base14 font.
In this case the AFP Renderer will take the font metrics from the built-in font. By default the AFP Renderer converts all images to 8 bit grey level. The bits-per-pixel attribute is ignored if mode is “color”. The include-page-overlay extension element allows to define on a per simple-page-master basis a page overlay resource.
The mandatory name attribute must refer to an 8 character space padded resource name that must be known in the AFP processing environment. The include-page-segment extension element allows to define resource substitution for fo: The include-page-segment extension element can only occur within a simple-page-master.
Multiple include-page-segment extension elements within a simple-page-master are allowed. The value of the mandatory src attribute is compared against the value of the src attribute in fo: The tag-logical-element extension element can only occur within a simple-page-master. Multiple tag-logical-element extension elements within a simple-page-master are allowed. The name and value attributes are mandatory. This will create an RTF rich text format document that will attempt to contain as much information from the fo document as possible.
This is primarily for testing and verification. We use that to verify the functionality of FOP’s layout engine. More information on that can be found on the page dedicated to the Intermediate Format. The AWT viewer shows a window with the pages displayed inside a Java graphic. It displays one page at a time. The fonts used for the formatting and viewing depend on the fonts available to your JRE. It is possible to directly print the document from the command line. It is possible to directly create bitmap images from the individual pages generated by the layout engine.
Currently, two output formats are supported: The quality of the bitmap depends on the target resolution setting on the FOUserAgent. The default value for the “transparent-page-background” setting is “false” which paints an opaque, white background for the whole image. If you set this to true, no such background will be painted and you will get a transparent image if an alpha channel is available in the output format.
In addition to the above values the TIFF renderer configuration allows some additional settings:.
Note that not all compression schemes may be available during runtime. This depends on the actual codecs being available. Here is a list of possible values:. This was originally developed to accommodate an archive system that could only accept plain text files, and is primarily useful for getting a quick-and-dirty view of the document text. The renderer is fo limited, so do not be surprised if it gives unsatisfactory results.
The Text renderer works with a fixed size page buffer. The textCPI is the effective horizontal characters per inch to use. The textLPI is the vertical lines per inch to use. From these values and the page width and height the size of the buffer is calculated.
Apache FOP Output Formats
The formatting objects to be rendered are then mapped to this grid. Graphic elements lines, borders, etc are assigned a lower priority than text, so text will overwrite any graphic element representations. Because FOP lays the text onto a grid during layout, there are frequently extra or missing spaces between characters and lines, which is generally unsatisfactory. Users have reported that the optimal settings to avoid such spacing problems are:. Due to the state of certain renderers we moved some of them to a “sandbox” area until they are ready for more serious use.
The output formats in the sandbox are marked as such below. This format creates an SVG document that has links between the pages. This is primarily for slides and creating svg images of pages. If the SVG is viewed on a system where the fonts are different, such as another platform, then the page may look wrong.
There’s a number of output formats which are on our wish list. We’re looking for volunteers to help us implement them. Configuration The PostScript renderer configuration currently allows the following settings: Limitations Images and SVG may not be displayed correctly. SVG support is far from being complete.