[opencms-dev] generating pdf files

Manfred Pruntsch manfred.pruntsch at ifcos.com
Thu Apr 25 16:58:31 CEST 2002


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