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

Author: Yozshulmaran Shagal
Country: El Salvador
Language: English (Spanish)
Genre: Marketing
Published (Last): 3 January 2018
Pages: 114
PDF File Size: 2.68 Mb
ePub File Size: 4.45 Mb
ISBN: 723-9-99654-629-6
Downloads: 99466
Price: Free* [*Free Regsitration Required]
Uploader: Fegor

The renderers do not all have the same set of capabilities, sometimes because of the output format foo, 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 (Formatting Objects Processor)

If FOP used the font metrics from its own font subsystem but still used Java2D for text painting in the Java2D-based renderers, this could probably be achieved. However, this approach hasn’t been implemented, yet. The clue is to use the intermediate format. The trick is to layout the document using FOP’s own font subsystem but then render the document using Java2D.

Here are the necessary steps using the command-line:. 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.

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 size but can potentially increase the memory needed in the interpreter to process.


The default value for the “safe-set-page-device” setting is “false”. The default value for the “dsc-compliant” setting is “true”. Setting it to “false” will break DSC compliance by minimizing the number of setpagedevice calls in the postscript document output.

This feature may be useful when unwanted blank pages are experienced in your postscript output. 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 default value for the “disable-pjl” setting is “false”. PJL commands can be disabled if you set this value to “true”. 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.

Apache FOP Output Formats

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 output-bin extension attribute on fo: Not all PCL printers support the same output bins. Usually, “1” is the upper output bin, “2” is the lower rear output bin. The duplex-mode rf attribute on fo: Not all PCL printers support duplexing.

Usually, “0” is simplex, “1” is duplex long-edge binding aapache, “2” is duplex short-edge binding. FOP does not create document indices. There are still a big number of older or limited MO: AFP has grown in functionality over time and not every environment supports the latest features. We’re trying to make AFP output work in as many environments as possible. However, to make AFP output work on older environments it is recommended to set to configuration to 1 bit per pixel see below on how to do this.

In this case, all images are converted to bi-level images using IOCA function set 10 FS10 and are enclosed in page-segments since some implementation cannot tp with IOCA objects directly. If a higher number of bits per pixel is configured, FOP has to switch to at least FS11 which may not work everywhere. 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.

A CID-keyed font Type 0, double-byte outline font configuration is much the same as an outline font. 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 base-uri 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, all manually configured fonts are embedded, unless they are matched in the referenced-fonts section of the configuration file. However, the default fonts shown above will not be embedded. By default the AFP Renderer creates output with a resolution of dpi.

Apache FOP (Formatting Objects Processor) – Wikipedia

By default the AFP Renderer converts all images to 8 bit grey level. The bits-per-pixel attribute is ignored if mode is “color”. When the native attribute is specified and set to “true”, all image resources will be natively injected into the datastream using an object container rather than ffop converted into an IOCA FS45 image.

Support for native image formats e.

This will top have an effect if the color mode is set to “color”. When the color mode is set to 1 bit bi-levelthe “dithering-quality” attribute can be used to select the level of quality to use when converting images to bi-level images.

Valid values for this attribute are floating point numbers from 0. For the higher settings to work as expected, JAI needs to be present in the classpath. If JAI is present, 0. The higher the value, the higher the quality and the slower the processing of the images.

But not all environments handle these colors correctly. That’s why a setting is supported that paints the rectangles using an ordered dither pattern bi-level with an inline IOCA FS10 image that is used together with the “replicate and trim” mapping.

The optional “shading” element can be used to control the shading mode. Its default value is “color”. To enable the dithered mode, use “dithered”. By default the AFP Renderer will place all data resource objects such as images within the document of the main output datastream. By default, bitmap image objects or page segments derived from them are put in the print-file-level resource group and GOCA graphics are inlined for compatibility with the AFP Workbench tool. It is possible to override these defaults, either per image see the afp: The possible values for the attributes are “inline” and “print-file”.

In the future, additional possibilities may be added. 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.