AW: [opencms-dev] generating pdf files

Andreas Schouten Andreas.Schouten at framfab.de
Fri Apr 26 09:34:38 CEST 2002


Hi,

you only need the fop-library if you want to create pdf's dynamically.
Static pdf you have uploaded into the system (ResourceType plain or binary)
will be delivered correctly by OpenCms. The mimetypes OpenCms uses are
defined in:
${tomcat_home}/webapps/opencms/WEB-INF/occlasses/mimetypes.properties . If
you edit this file you have to restart OpenCms.

Regards,
Andreas

-----Ursprüngliche Nachricht-----
Von: Manfred Pruntsch [mailto:manfred.pruntsch at ifcos.com]
Gesendet: Donnerstag, 25. April 2002 16:59
An: opencms-dev at www.opencms.org
Betreff: RE: [opencms-dev] generating pdf files 


Hi Marian,

I performed the following steps:
- first I loaded a pdf file with the opencms synchronization mechanism in
the /download/ folder.
- then I placed a link in a template pointed to the pdf
- finally I started the browser and the click on the pdf has lauchned the
Acrobat reader plug-in
The pdf was displayed in a absolutly correct way. The saving goes on without
any problems.

The correct MIME-Type for PDF Files is "application/pdf". Because I'm not
especially familiar with java here is a code snippet in php:

header("Content-type: application/pdf")

will send the used Content-Type to the browser.
I would suggest in java it looks similiar like that:

        Enumeration e = request.getHeaderNames();
        while (e.hasMoreElements()) {
            String name = (String)e.nextElement();
            String value = request.getHeader(name);
            out.println(name + " = " + value);
... (not exactly but nearby...)

Do you have the appropriate fop-library installed sended by Andreas
Schouten?
After installing the sun was shining. May it be that's the reason why?
I will send you my fop so you can compare with your version.

best regards,
Manfred Pruntsch





> -----Original Message-----
> From: owner-opencms-dev at www.opencms.org
> [mailto:owner-opencms-dev at www.opencms.org]On Behalf Of Marian Kasala
> Sent: Thursday, April 25, 2002 11:58 AM
> To: opencms-dev at www.opencms.org
> Subject: Re: [opencms-dev] generating pdf files
>
>
>
> Hi,
>
> my problem is different one. I don't intend to generate PDFs from
> html pages,
> I just have PDFs stored in /download/ directory for downloading from site.
> But when I access this file it is not opened correctly  in
> browser. I expect
> to be launched Acrobat Reader but instead PDF is presented like html page.
>
> I think it's problem of setting correct content-type (application/pdf).
> Isn't it?
> And I expected PdfLauncher does this.
> What is correct solution for this?
>
> Best Regards,
> Marian Kasala
>
>
>
> ----- Original Message -----
> From: "Manfred Pruntsch" <manfred.pruntsch at ifcos.com>
> To: <opencms-dev at www.opencms.org>
> Sent: Wednesday, April 24, 2002 4:56 PM
> Subject: [opencms-dev] generating pdf files
>
>
> >
> > Hi,
> >
> > How can I generate a pdf file from a html page?
> > opencms has a class (CmsPdfLauncher) for XML templates. The PDF
> rendering
> is
> > based on the Formatting Objects Printer (FOP, xml.apache.org/fop)
> > cite: (javadoc from this class)
> > > This can be used generating PDF output for XML body files
> > > using XML template and subtemplate technology.
> > > The template data has to be XSL:FO coded.
> > > The selected body should define a start template class using
> > > <PAGE>  *   <CLASS>...</CLASS> * </PAGE>
> > > If no start template is defined, the class given by the
> parameters will
> be
> > used.
> >
> > what are needed?
> > - a xml mastertemplate with subtemplate
> > - a xsl:fo coded template (how the pdf looks like?! In the fop doc are
> many
> > examples)
> > - a java class launching the pdf generating.
> >
> > My question is, how it goes on. In other words:
> > How do I perform a simple 'Hello World' example for getting pdf to
> > understand the basic mechanism.
> >
> >
> > best regards
> > Manfred Pruntsch
> >
> >
>
>
>



More information about the opencms-dev mailing list