CoolTools |
|||||
The RenderX sales team created several cool tools - called CoolTools - to stimulate thought and exchange new ideas about things that can be accomplished with XSL FO (XSLFO) and RenderX XEP: |
|||||
|
|||||
We put together a quick XSL for magnifying documents. As with most CoolTools, this one relies on the XEP Intermediate Format (XEPOUT). There are several ways to get XEPOUT format. To format a modified XEPOUT, one just passes it back through RenderX XEP. The document is not recomposed, only the final output is generated as this final process from XEPOUT to output (like PDF or PostScript) is very fast and takes very little memory.
What is not documented at the above link is that there is also an XEPOUT element called
The
If the above We also need to change the page dimensions to accommodate the size. We could write an easy identity-translate to operate on XEPOUT and scale pages. By the way, choose different values for scale X and scale Y, if unproportional scaling is what you want. Give it a try! Full text is available here. |
|||||
Using Google Maps API and RenderX to insert dynamic maps in PDF |
|||||
This example is a complete XSL template for generating a Google map image on the fly. |
|||||
|
|||||
This is a general set of XSL templates to generate a Google Map from source address information. This process works by first submitting the address to the Google Geocoding Service which returns an XML file containing additional information. This additional information includes the latitude and longitude of the specified location. This XML is loaded into a variable which is an internal XML document and the nodes processed to extract the needed data. The coordinates are parsed from the XML document and passed to the Google Static Maps API to generate an image with a marker at the address provided. Various other parameters can be set, including the zoom factor, image size, and map type. A sample PDF is available here. Full text is available here. |
|||||
Using Google Chart API and RenderX to generate dynamic charts |
|||||
This CoolTool XSL produces the formatted URL for an Google has a publicly available chart server. You can get more information on the Google Chart Server API here. All the parameters which govern the look of the pie chart are passed through the URL, and the Google Chart API returns a PNG image of the chart. These parameters include the data and labels, as well as the colors, size, orientation, and type of chart (2D, 3D, and concentric for pies). While we do have some nice style sheets we use to generate dynamic SVG pie charts and bar charts, we also wanted to share you with you this simple, reusable style sheet that you can include in any project. A sample PDF is available here. If you wish to play for yourself, here is some sample data which contains sample XSL and the CoolTool XSL. Full text is available here. |
|||||
A style sheet for converting Excel XML format to XSL FO (XSLFO) tables |
|||||
Our internal invoicing system used a method of converting Microsoft Excel to XML data and passing that data to RenderX XEP to format. So we decided to bump it up a little and put together an XSLT to convert Microsoft Excel's XML format to XSL FO (XSLFO). Since Microsoft Office 2003, Excel has had a function to save an Excel spreadsheet in XML format. This XML file is a self-contained file: It has all the data and all the styling in the structured content.
We decided that we would focus on the Print Area range – that is the only information that is extracted from a spreadsheet. This also allows us to use Excel's Print Titles feature to create XSL FO (XSLFO) table headers. We are not doing any calculations, so we just skip the formulas and use the stored values to create our table. Lastly, we implemented it such that you can just reference the XML Excel document and use the This example is just a basic example, and you are welcome to improve it. Sample PDF output is available here. Download the package here. Full text is available here. |
|||||
"N-up" processing of pages |
|||||
This example shows how to place several pages on one page (sheet) by manipulating XEPOUT format.
In the "n-up" case, the custom transform goes through the XEPOUT for any document and makes a new XEPOUT with say 4 pages for each page. Copying Short primer on XEP Intermediate FormatRenderX XEP produces output from XSL FO (XSLFO): XML + XSL -> XSL FO -> XEP Software -> PDF, Postscript, AFP, XPS, XHTML, and SVG ... Most people write XSL to get to XSL FO from XML, others write XSL FO directly from some application. RenderX gets from XSL FO (XSLFO) to output by producing internal structures of the page output representation – the document result tree. This is called the XEP Intermediate Format or XEPOUT for short. XEPOUT can be serialized to disk. If we "peak under the covers" into "XEP Software", we would see: XML + XSL -> XSL FO -> (XEP Formatter -> XEPOUT -> XEP Generator) -> PDF, Postscript, ...
The XEPOUT file is an XML that represents the entire document structure. It contains a So consider the applications here: XML+XSL -> XSL FO -> XEP Formatter -> XEPOUT -> My Custom Transform/Application -> New XEPOUT -> XEP Generator -> PDF, Postscript, ... There are many things that can be done – from the very, very simple to the very complex. There have been many other applications written that leverage this ability. Use your imagination… and, if you have something that you think cannot be done, ask us. Full text is available here. |
|||||
Scale to fit images |
|||||
Some users need a way to scale down images to fit within a constrained space in both dimensions. We have created a solution set that uses the current technology for this purpose. The basic solution consists of running RenderX XEP in a way to process only the images and gather information on the actual image size from the XEP Intermediate Format (XEPOUT). Then one can run RenderX XEP again with the main style sheet and use that information when formatting the document. This can of course be done in a tool chain with two commands (instead of one) or through the API and passing parameters. All of this can be executed from a simple batch (.BAT) file. The XEPOUT file is generated automatically, used in the second transformation, and then deleted. In the case of some users who are dynamically generating PDFs, certainly the XEPOUT file can be generated in memory and passed as a parameter to the second transformation. Just sample XML and XSL without images is available here. The whole package with images is available here. (7 MB) Sample output in various sizes:
Full text is available here. |