Slashdot Mirror


Pretty Printing From An XML File?

Omega1045 writes "Where I work we are developing a new product that receives an XML document (on a W2k workstation), and we need to format and print said document. We are currently using XSLT + CSS to build a cool little HTML page out the the XML, then use a browser to print out the HTML. However, while HTML is a nice format for display, it is not a nice format for printing. We have messed around with the idea of spitting out Rich Text with XSLT. However, Rich Text is confusing and quite frankly sucks. We are looking for a (free if possible) format that we can translate our XML document into via XSLT, and print. The best idea we have at this point is to translate into a Word or OpenOffice XML schema document, and use one of those applications to print. Other ideas?"

5 of 65 comments (clear)

  1. FOP by pi_rules · · Score: 4, Informative

    Apache FOP Homepage

    Very powerful if you ask me. I used it on a project back in 2000-2001 and was pleased with how it turned out at the time. I'm sure the current product is much, much, better than it was back then.

  2. Try PDF by Mastos · · Score: 4, Informative

    I have a similiar problem I solve through the use of XSLT and XSL-FO. Use XSLT to transform the XML into XSL-FO. Then, use Apache FOP to render the XSL-FO into PDF.

    Another variation is to transform your XML into an HTML subset, then use a standard XSLT to transform the HTML into XSL-FO. A similiar technique is used by Aurigadoc to create all sorts of output formats using an XML source.

  3. XSLT-FO by JumpSuit+Boy · · Score: 4, Informative

    http://xml.apache.org/fop/
    http://www.cranesoftwr ights.com/training/ has a book about how do this that was created using XSLT-FO

    There are also paywhere implimentations XSLT-FO this. Basicaly it is the extension to XSLT for print.

    --
    Oh really?
  4. LaTeX by Asgard · · Score: 4, Insightful

    Generate a LaTeX document file, compile it using PDFLatex and print. Or, use normal LaTeX and print directly from it, depending if .dvi files offend you.

  5. You're almost there... by BladeMelbourne · · Score: 4, Insightful

    Having been in the same situation before, this is what I suggest...

    Take the XML and the XSL and transform it into 100% valid XHTML. HTML 4 is deprecated, the standard will not be updated. XHTML 1.0 is 5 years old already - start to use it.

    Use CSS - pay attention to
    @media screen,print
    { /*Styles for browser and printer*/
    }
    @media screen
    { /*Styles for browser only*/
    }
    @media print
    { /*Styles for printer only*/
    }

    If it doesn't print well, you probably need to refresh your CSS here: http://www.w3.org/style

    Goodluck.