Convert XML to pdf and\or doc

Posted on 2005-04-12
Last Modified: 2008-02-01
I don't work much with XML and am brand spanking new to java (never took a class, don't have any basics, I have worked with VB for years) and I have been asked to use InfoPath and VS .Net to convert XML files to pdf and doc format.  THus far I have figured out that I need to use XslTransform, but that is as far as I can figure.  Can anyone help me out with a code sample in javaScript to illustrate how this is done.  I woulod greatly appreciate it.  Thanks.
Question by:Wonderflub
    LVL 29

    Expert Comment

    If you're using Java then you can use POI from jakarta to convert xml to things like Word and Excel files. You can create pdf's by using XSL-FO which is the standard way in XML.

    here's a good general link

    Author Comment

    I was asked ot use the built in functionality of VS .Net and office 2k3.  There isn't a simple way to do this using built in code?

    Author Comment

    ok, how about a point in the right direction.  In my research I have found people say that I can't use xslTransform and I have to use msxml.  Is this true, should I be walking down this path instead.  This is all a lot for me to learn in a short amount of time and I htink my head is spinning, can anyone make it stop :-).

    Seriously though, any help?

    Author Comment

    WHat about this.....  would this work

    var objDial = Server.CreateObject('Stonebroom.XSLTransform');
    var strStatus;                            // to hold the status message
    var strXMLFile = '/data/xml/myfile.xml';  // the XML source file
    var strXSLFile = '/data/xsl/myfile.xsl';  // the XSL style sheet file
    var strOutFile = '/results/myfile.doc';  // path and name for the resulting disk file
    blnWorked = objTransform.TransformXML(strXMLFile, strXSLFile, strOutFile, strStatus);

    for at leas tthe doc file????
    LVL 10

    Accepted Solution

    <<<for at leas tthe doc file????>>>


    You need to look at what output types are generated by what XSLT engines.

    Here's MSXSL:
      method = "xml" | "html" | "text" | QName
      version = nmtoken
      encoding = string
      omit-xml-declaration = "yes" | "no"
      standalone = "yes" | "no"
      doctype-public = string
      doctype-system = string
      cdata-section-elements = QNames
      indent = "yes" | "no"
      media-type = string

    Here's Apache's FOP:

    Render XSL:FO with Apache FOP rendering engine

          <type>pdf</type>              <!--     <type> contains one of pdf, svg, pcl, awt, print, text, ps, mif, xml    -->

    DOC won't work but you can import HTML into a DOC file.

    For a pdf file, you need to find the right transform engine.

    Author Comment

    ok, so I HAVE to use FOP, I will have to try to figure out how to do that.

    They have asked me to just create a generic transform engine that will automate the process, so I am no longer looking at one singular file, but many.  If the script language is JScript for the infopath forms, do I have to use Java, or can I create a transform engine in VB?

    Author Comment

    ok, I am going to start a new question, since I am now asking more than one thing and diverting to a different direction.

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now