You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Benoff <db...@covad.net> on 2003/10/05 20:26:07 UTC

Mime type not getting set for fo2pdf serialization

Hi all,
I’m getting bad output from my fo2pdf serialization (I’ve pasted a
sample below).  Based on an old thread (HYPERLINK
"http://www.mail-archive.com/cocoon-users@xml.apache.org/msg12064.html"h
ttp://www.mail-archive.com/cocoon-users@xml.apache.org/msg12064.html) I
gather that the problem is that the mime type is not getting set for
some reason so the browser is outputting raw pdf code.  My serializer
setup is below, and is setting the mime type, so I am stumped as to what
the problem is.  Any hints would be much appreciated.
 
Thanks,
David
 
 
Here’s the serializer setup:
    <map:serializer name="fo2pdf"
 
src="org.apache.cocoon.serialization.FOPSerializer"
                      mime-type="application/pdf">
        <user-config>C:/java/hibapp2/fop-fonts/config.xml</user-config>
    </map:serializer>
 
And the pipeline:
    <map:match pattern="*.pdf">
        <map:generate type="file" src="invoice.xml" />
        <map:transform type="xalan" src="test.xsl" />
        <map:serialize type="fo2pdf" />
    </map:match>
 
And here’s the garbage output I get:
%PDF-1.3 %ª«¬­ 4 0 obj << /Type /Info /Producer (FOP 0.20.5) >> endobj 5
0 obj << /Length 90 /Filter [ /ASCII85Decode /FlateDecode ] >> stream
Garg^iR2p+<%p/W1Je?Kj"^U3a]o#Wl!/rM#!ck#?u?;c1G^u;1UJi5#g$)&egO*A0%!XS<=
&-SEXgt/!5Om1.0~> endstream endobj 6 0 obj << /Type /Page /Parent 1 0 R
/MediaBox [ 0 0 612 792 ] /Resources 3 0 R /Contents 5 0 R >> endobj 7 0
obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Helvetica
/Encoding /WinAnsiEncoding >> endobj 1 0 obj << /Type /Pages /Count 1
/Kids [6 0 R ] >> endobj 2 0 obj << /Type /Catalog /Pages 1 0 R >>
endobj 3 0 obj << /Font << /F1 7 0 R >> /ProcSet [ /PDF /ImageC /Text ]
>> endobj xref 0 8 0000000000 65535 f 0000000464 00000 n 0000000522
00000 n 0000000572 00000 n 0000000015 00000 n 0000000071 00000 n
0000000251 00000 n 0000000357 00000 n trailer << /Size 8 /Root 2 0 R
/Info 4 0 R >> startxref 650 %%EOF

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003
 

Re: Mime type not getting set for fo2pdf serialization

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
David Benoff dijo:
> Hi all,
> I’m getting bad output from my fo2pdf serialization (I’ve pasted a
> sample below).  Based on an old thread (HYPERLINK
> "http://www.mail-archive.com/cocoon-users@xml.apache.org/msg12064.html"h
> ttp://www.mail-archive.com/cocoon-users@xml.apache.org/msg12064.html) I
> gather that the problem is that the mime type is not getting set for
> some reason so the browser is outputting raw pdf code.  My serializer
> setup is below, and is setting the mime type, so I am stumped as to what
> the problem is.  Any hints would be much appreciated.

Hi David:


I guess you are trying to see the PDF in a Windows machine. Sometimes IE
has some problems in running the PDF reader. I dont know why, but seems to
be because IE uses file extension instead of mime-type.

Try to download the file and check if you can then open it with your PDF
Reader. If this works. The problem is not related to Cocoon. To solve this
problem I suggest you to reinstall the PDF reader. Sometimes it solves the
problem in some machines.

Second guess: Your pipeline looks good. Try to remove the <user-config>
tag. What you have there?

If the above does not work, then another approach I recomend you is: step
slow with PDF generation. First do a simple test to see if there is no
error in a simple page.




Best Regards,

Antonio Gallardo.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Mime type not getting set for fo2pdf serialization

Posted by David Benoff <db...@covad.net>.
Thanks very much for the tips Antonio.  Actually, on my setup the
transformation explicitly bombs out with an exception if Batik isn't in
the path.  Anyway, I wound up resolving the issue by calling
response.setContentType("application/pdf"); within my business class
before forwarding to cocoon.  I have no idea why I can't just rely on
the fo2pdf serializer to set the mime type, but, hey, it works.

Thanks again,
David Benoff

-----Original Message-----
From: Antonio Gallardo [mailto:agallardo@agsoftware.dnsalias.com] 
Sent: Sunday, October 05, 2003 10:46 PM
To: users@cocoon.apache.org
Subject: Re: Mime type not getting set for fo2pdf serialization

David Benoff dijo:

Hi David:

I am back, to provide you another tip ;)

FOP block depends on Batik block. Do you have Batik block included in
your
Cocoon build? If not, then you don't got any error but it simply does
not
work.

Best Regards,

Antonio Gallardo




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003
 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Mime type not getting set for fo2pdf serialization

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
David Benoff dijo:

Hi David:

I am back, to provide you another tip ;)

FOP block depends on Batik block. Do you have Batik block included in your
Cocoon build? If not, then you don't got any error but it simply does not
work.

Best Regards,

Antonio Gallardo




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org