XMLMill - convert xml to pdf with java. Generate PDF from xml/xsl.

High volume xml-xsl to PDF Generation

This page as PDFPrinter friendly pageEmail this page to a friendSubscribe to our mailing list


General questions

Is XMLMill suited for me ?

If you are a Java developer or end-user who wants to generate PDF files without knowing anything about PDF, you can use XMLMill. The only prerequisite is that you know XML and XSL.

When should I use it ?

XMLMill can be used in a lot of situations:

  • If there is a need to present information coming from different applications (mainframe, ERP systems, CRM systems , ....) in a flexible, easy way. Just put your data in a XML document and let XMLMill have the job done.
  • Want to make nice looking PDF documents with minimum effort ? Try XMLMill.
  • Need to generate invoices out of your invoicing system ? Just export the data in XML and let XMLMill generate those nice looking PDF invoices.
  • All other situations where data need to be presented !

How does it work ?

Quite straightforward:

  • One way is to generate a XMLMill xml file containing data + formatting descriptions of how to format the PDF document.
  • Another way is to use a XSL file that will transform your XML data to a XMLMill xml file.

Can I separate data from content and still generating PDF files ?

Of course, this is how to proceed:

  1. You have a regular XML file containing you data.
  2. You have a XSL file that will contain the formatting and transforming instructions.
  3. A XMLMill xml file will be generated that will be used to generate the PDF document.

How will I know when a new page has to be generated ?

XMLMill will handle this for you. If the text is longer than the page, a new page will automatically be added to the document.

What about header and footers, page-numbering, ...

All these formatting options are included. You can generate professionally looking documents just as you would generate them with your favorite word processor.

If you are familiar with CSS or even HTML tags, you will have no problem with XMLMIll"s declaration of properties, units of measurements and colors.

How is the (untrained) user of XMLMill supposed to edit the source documents (for example, the XML or XSL documents) ?

In XMLSpy (http://www.xmlspy.com) the user can enter a xml document and have it checked on well-formedness and have it validated on the fly. Just provide the XMLMill DTD file to the user.

Also check oXygen (http://www.oxygenxml.com). oXygen also provides a graphical tree-like view of the document and assists the user with a code-insight that automatically present the user with the valid tags for the current position of the cursor, based on the specified DTD.

Why should I use XMLMill and not apache fop (or any other xml/xslt converter) ?

When our users were starting to use fop they where complaining about the difficulty in using it. Why not just defining an xml document like a regular Word document ? First you define the layout and orientation, then the page-layout and finally the elements (paragraph, textbox, images, ...). Hence we developed XMLMill. As of version 1.2 the Enhanced Element Positioning) is another reason for using XMLMill.

Product Feature questions

Does XMLMill support Asian languages?

Yes, XMLMill currently supports all Asian languages written from left to right, top to bottom. Check our examples page which show a document generated in with Mingliu (Chinese) font.

Can XMLMill access my EJB's?

Absolutely. Since the library is data-independent, any data source available to Java is fair game.

Can the XMLMill library be used to generate PDF documents in a servlet?

Yes. XMLMill works great in a servlet environment. Take care of buying the correct number of licenses, as the simultaneously generation of PDF file is limited to the number of licenses. See our license policy page.

Does XMLMill support Type1 fonts?

Yes, XMLMill supports Type1 fonts. These can be embedded or even subsetted in the generated .pdf document.

Does XMLMill support Barcode ?

Yes, you can directly generate barcode in your pdf document without the need to have separate barcode fonts.

Can I convert files from PDF to XML ?

No. With XMLMill it is only possible to generate PDF from XML/XSLT. It is nearly impossible to generate XML from PDF as the PDF format does not indicate which elements there are (as paragraphs, headers, footers, ...). The PDF format only defines graphical elements such as text, lines and rectangles (among others).

Can XMLMill position elements (text, numbers and images) in an exact position on the page?

Yes, textboxes and images can exactly be put on a x,y position using the topleft attribute. There are different examples in the trial download using the topleft attribute.

Can XMLMill lock documents from alteration? (ie prevent people altering the final PDF) ?

Yes, XMLMill support 40 bit and 128 bit encryption.

Technical questions

Does XMLMill works on both NT and Solaris?

Yes, we have clients running XMLMill on a variety of Operating systems, like NT, Solaris, AIX, SuSE, RedHat and other Linux flavors. As XMLMill is written 100% JAVA just be sure running a JDK/JRE/JVM 1.3.x or higher.

Does XMLMill works on WebSphere ?

Yes, we have clients running XMLMill on a variety of application servers, like WebSphere, WebLogic, Oracle's IAS, Tomcat, Boss and others.

What image types does XMLMill support for embedding?

Currently XMLMill supports JPG, GIF (all types), BMP, PCX and PNG.

What barcode types does XMLMill support ?

Currently XMLMill supports code39, code39e, code128, Codabar and AusPost. If you need other barcode types just let us know. We will add the requested type into XMLMill and send you a patch.

Do you offer a .dll to be used with ASP or VisualBasic ?

No, XMLMill is written in Java and currently we do not offer a dll version of XMLMill to be used with ASP and/or Visual Basic.

I'm unable to get the applet (xmlmill interactive) to convert any of the xml example files that use xsl stylesheets. I get following error: javax.xml.transform.TransformerException: java.io.IOException: The system cannot find the path specified.

Problably you don't use the JDK1.3.x Please use the JDK 1.3.x or a higher version.

I have Xerces.jar and Xalan.jar in my classpath. Do I need to include the sXerces.jar and sXalan.jar in the classpath as well ?

It depends:

  1. If you want to use XMLMill interactively (in a browser using xmlmill.html) you don't need to do anything. Normally the applet will find the sxerces.jar , sxalan.jar and sxml-apis.jar in the directory where the applet is. If you have some trouble, remove xalan.jar and xerces.jar from the classpath.
  2. If you want to use XMLMill in batch, put sxerces.jar , sxalan.jar and sxml-apis.jar in the classpath before using XMLMill and remove any references in the classpath to other versions of Xalan or Xerces.
  3. If you want to use XMLMill on a server, you should put the xalan.jar, xerces.jar and sxml-apis.jar in the WEB-INF/lib directory, so the servlet container can find the classes. Be aware that your container already contains a default XML/XSL parser. You should override this setting to allow XMLMill to use the above mentioned .jar files. Please check your documentation manual. For example, with Resin (http://www.caucho.com ) the default parsers can be overridden adding following lines in the resin.conf setting: <system-property javax.xml.transform.TransformerFactory =
    <system-property javax.xml.parsers.DocumentBuilderFactory = "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
    <system-property javax.xml.parsers.SAXParserFactory =

I am receiving this error when trying to run a servlet: java.lang.NoClassDefFoundError: javax/xml/transform/Source at com.xxx.xx.xxx.GenPDF.doGet(GenPDF.java:48). It appears that I am missing a package of some sort.

The javax/xml/transform/Source is a class in the sxml-apis.jar file. Did you include this jar in your WEB-INF lib directory ?

When Internet Explorer parses my XSL and XML files, it creates HTML pages. Can you tell me if XMLMILL can convert the displayed HTML pages to PDF? I need a PDF version of my output.

You can reuse your xml files (which contain your data to be displayed), you need to create a xsl file that will transform the xml file to a .mill file (you cannot reuse your current xsl file).

When I generate a PDF file from a servlet, the document is opened under Netscape Navigator and Opera, but refuses to open under Internet Explorer, although Adobe opens correctly ?

What happens is that Adobe is opened in the browser but the document doesn't appear. This happens when the size of the PDF document is smaller than the buffer-size defined by your servlet container. The standard buffer-size is 8192 bytes (check your container configuration files to define the actual buffer-size). To solve this problem, be sure that at lease 8192 bytes are in the outputStream. Add following code to your servlet code:

[003]         ostream.write(new byte[8192]);
[005]         response.setContentLength(transform.getDocumentSize()+8192);

Please check the Fetch.java and Fetch2.java file in the download.

I am evaluating XMLMill PDX and I have encountered the following problem: When running the invoices example from your website I get the following output in the log file : Unable to getPDFImage: java.io.IOException: images\magnolia.jpg is not found. Do you have any pointers for me as to what might be wrong?

Did you extract alle folders of the the download zip file ? Did you extract the files with 'Use folder names' checkbox on (if you use Winzip) ? If not (all files will be in one directory) XMLMill will not be able to find the Magnolia image as this images is relative defined in the invoices.xsl file .

How do I know which version of Xalan and Xerces is used when generating a .pdf document ?

Look in the generated log file. It will mention the used version of Xalan and Xerces.

I installed version XMLMill for Java 1.32 and now I get really strange errors. The log file looks like this:

[001] (...)
[003]       Set log file: C:\xmlmill132\test\xmlmill_1034671304937.log
[004]             !0aWs
[005]       -Ti
[006]       %HC:\xmlmill132\test\exception.xmlU6 
[007]       C:\Documents and  Settings\test\Desktop\output\exception.pdf
[008]       ?n^i?:Yt0(nrMvOm44n
[009]       PSDl84~e).;
[010]       :q2L+?nqt4U ?5n
[011]       s$9yOe5?~
[013]       (...)

What is going wrong ?

Problably you are using JDK 1.3.0. Please upgrade to JDK 1.3.1_05 or a later version of the SDK (1.4.x is also OK).

Why do all the .jar files start with a 's' character, specifically sxalan.jar, sxml-apis.jar, sxsltc.jar and sxercesImpl.jar ?

These jar files are so called 'signed' jar files so they can be used in an applet environment. In case you do not use XMLMill with an applet (but in batch or on your application server) you can also use the regular xalan.jar, xml-apis.jar, xsltc.jar and xercesImpl.jar jar files. All these .jar files can be found on Apache's website, Xalan's page.

I am trying to generate an invoice. The table that shows the sold items works really fine for the first five pages, however the sixed and the following pages are blank. What is going wrong ?

Probably you are using the trial version which only generates five pages. When you buy XMLMill, you will receive the full working version that generates all the pages of the PDF document.

I have some display problems with numbering pages with XMLMill. The total number of pages is displayed a line under the current pagenumber. How can I solve this ?

This bug was solved in release 1.30. Please download the latest trial version (in case you are testing the product) or, if you are a registered user, ask an upgrade via upgrade@xmlmill.com .

I am still using an older version of XMLMill (1.22) and would like to upgrade to the latest version. Do I have to make any changes to my tags or attributes ?

The best procedure to make your transition as smooth as possible is as follows:

  • Back up all your xml / xsl files first.
  • Read all release notes from your current version to the latest version in correct order (from oldest release notes to newest).
  • Adapt you xsm / xsl files accordingly to the release notes. We try to keep the tags/attributes as stable as possible, but it is inevitable that some tag/attributes are changed over the versions as we are expanding the features.

How long does it take to convert an 85K XML file to PDF?

This depends on a lot of circumstances:

  • in which environment will it run (processor type, number of processors, available memory, JVM version used, ...).
  • how are the xml and xsl built (for loops, number of nodes, ...). The best answer is just to try it.

You can use the trial version although it will just generate five pages, the time needed will approximate the time needed to build the full document by the licensed version (just add 3% to 5%procent). The log file generated will display the milliseconds (elapsed) needed and the number of bytes written).

I get the error: Catch-error: trying to write to closed outputstream when my servlet tries to write someting to the stream after after calling transform.transform().

This error was solved in version 1.32.R1, a small revision of version 1.32. Please download the latest trial version or, if you are a registered user, ask your upgrade via upgrade@xmlmill.com.

When I try to generate a PDF document I get the error:
javax.xml.transform.TransformerException: java.net.MalformedURLException: no protocol: xmlmill.dtd javax.xml.transform.TransformerException: java.net.MalformedURLException: no protocol: xmlmill.dtd at ...

Control that the path from the root to the directory in which the xmlmill.dtd or the xml or xsl file(s) reside does not contain any spaces. If using XMLMill in servlets you should check that the path the container follows to reach the xmlmill.dtd (using the getRealPath() method in the servlet examples Fetch.java) does not contain spaces.

I get the error: javax.xml.transform. Transformer Exception: java.lang. IndexOutOfBoundsException: Index: 0, Size: 0 when I try to generate a PDF document.

This error was solved in version 1.32.R2, a small revision of version 1.32. Please download the latest trial version or, if you are a registered user, ask your upgrade via upgrade@xmlmill.com.

I get the error: FATAL (...) java.net.MalformedURL Exception: unknown protocol: c when I try to generate a PDF document.

This error was solved in version 1.32.R2, a small revision of version 1.32. Please download the latest trial version or, if you are a registered user, ask your upgrade via upgrade@xmlmill.com.

When I print a PDF document from Acrobat, the margins are too big and the page content has shrunk.

When printing from Acrobat, make sure the "Fit to Page" checkbox (Acrobat 4) or the "Shrink oversized pages" checkbox (Acrobat 5) is OFF.

Support questions

License End-User Questions

License Reseller (OEM) Questions

Ordering Questions.

Copyright © 2001 - 2012. All rights reserved. XMLMill and XMLMill logo are trademarks of Pecunia Data Systems, bvba.
Powered by Apache CocoonPowered by XMLMill