xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando López Carballeda <ferna...@lopez.org>
Subject RE: HTML to PDF (or) XML to PDF
Date Tue, 12 Dec 2000 09:53:46 GMT
Hi,

I am working on the same way Transforming XML to FO and FO to PDF. Mixing
examples I prepare the next code:

import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XSLStylesheet;

public static void main () {

        String fileDoc = "prueba.xml";
        String fileXSL = "prueba.xsl";
        String filePDF = "prueba.pdf";

        try {
                System.out.println( "Cargo el documento XML que es la hoja
de estilo.");
                // Cargo el documento XML que es la hoja de estilo.
                XMLDocument xsldoc = DocumentFromFile( fileXSL);

                System.out.println( "Cargo el documento XML a
transformar.");
                // Cargo el documento XML a transformar.
                XMLDocument xml = DocumentFromFile( fileDoc);

                // Inicializa el stylesheet
                XSLStylesheet xsl = new XSLStylesheet( xsldoc, new
RL( "file", null, ""));

                //Crea documento de salida XML:FO
                XMLDocument outdoc = TransformXMLDocument( xml, xsl);

                root = outdoc.getDocumentElement();
                FileWriter outFile = new FileWriter(filePDF);

                FO2PDFFormatter(outdoc,outFile);

                outFile.close();

        } catch (Exception e) {
                System.out.println("Error en la generación del
xml:fo:\n\r"+e.toString());
                e.printStackTrace( System.out);

                System.exit(1);
        }

        System.exit (0);
}

from Cocoon:

/*-- $Id: FO2PDFFormatter.java,v 1.4 2000/08/18 22:42:27 stefano Exp $ --


============================================================================
                   The Apache Software License, Version 1.1

============================================================================

 Copyright (C) 1999-2000 The Apache Software Foundation. All rights
reserved.

 Redistribution and use in source and binary forms, with or without
modifica-
 tion, are permitted provided that the following conditions are met:

 1. Redistributions of  source code must  retain the above copyright
notice,
    this list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright
notice,
    this list of conditions and the following disclaimer in the
documentation
    and/or other materials provided with the distribution.

 3. The end-user documentation included with the redistribution, if any,
must
    include  the following  acknowledgment:  "This product includes
software
    developed  by the  Apache Software Foundation
(http://www.apache.org/)."
    Alternately, this  acknowledgment may  appear in the software itself,
if
    and wherever such third-party acknowledgments normally appear.

 4. The names "Cocoon" and  "Apache Software Foundation"  must not be used
to
    endorse  or promote  products derived  from this  software without
prior
    written permission. For written permission, please contact
    apache@apache.org.

 5. Products  derived from this software may not  be called "Apache", nor
may
    "Apache" appear  in their name,  without prior written permission  of
the
    Apache Software Foundation.

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND
 FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL
THE
 APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY
DIRECT,
 INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES
(INCLU-
 DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES;
LOSS
 OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND
ON
 ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR
TORT
 (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE
OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 This software  consists of voluntary contributions made  by many
individuals
 on  behalf of the Apache Software  Foundation and was  originally created
by
 Stefano Mazzocchi  <stefano@apache.org>. For more  information on the
Apache
 Software Foundation, please see <http://www.apache.org/>.

 */
package org.apache.cocoon.formatter;

....

Regards,
Fernando López Carballeda

-----Mensaje original-----
De: Andrew Stone
Enviado el: lunes, 11 de diciembre de 2000 23:49
Para: fop-dev@xml.apache.org
Asunto: RE: HTML to PDF (or) XML to PDF


Krish,
I am relatively new to the whole XML/PDF and web design for that matter.
However, I think the best approach would be to convert from XML to PDF.

Here is my reasoning...

Keep the process simple.  If you are wanting to convert from XML to PDF,
then why have an extra step of converting it to HTML first?  What if you
didn't
want to use HTML at all?  You would still have to convert it to HTML then to
PDF
using HTMLDOC.

There are actually other arguments I have, but I think this is the best.

I hope this helps...

andy

-----Original Message-----
From: Palaniappan, Krishnasamy [mailto:PalaniK@diebold.com]
Sent: Monday, December 11, 2000 5:24 PM
To: fop-dev@xml.apache.org
Subject: HTML to PDF (or) XML to PDF


Hi,
I have created stylesheets using XSLT to transform XML files into HTML. I
also have a need to convert the same XML files to PDF files. It looks like I
have 2 options, at the minimum:
1. Use FOP to convert the XML to PDF.
2. Use third-party software like HTMLDOC 1.1.9 that converts HTML files into
PDF.

Since I have already created the stylesheets to convert XML to HTML, I would
just have to use the GUI that comes with this software to further transform
the HTML to PDF.

Can someone tell me the advantages of using one approach over  the other? I
would like to go the FOP way but just want to know the differences.

Thanks,
Krish


Mime
View raw message