[Maypole] Generating PDF

From: Brian Glass (brian at glassbrian.com)
Date: Wed Sep 22 2004 - 21:08:35 BST


I'm generating PDF (and images) through Maypole. Here's an example of
how I generate images through Maypole (with HTML::Mason). I've moved
this to the view class because I think that's where it belongs.

    <%flags>
    inherit => undef
    </%flags>

    <%init>
    $request->{content_type} = $camera->content_type;
    $m->out( $camera->snapshot );
    </%init>

    <%args>
    $camera
    $request
    </%args>

However, when I try doing something similar with PDF the browser
(Firefox) creates an empty file for the "helper application" which in
this case is kghostview. Doing this request via telnet looks like:

    Trying 127.0.0.1...
    Connected to localhost (127.0.0.1).
    Escape character is '^]'.
    GET /CrossTrack/person/address_labels/ HTTP/1.1
    Host: 192.168.0.101

    HTTP/1.1 200 OK
    Date: Wed, 22 Sep 2004 19:19:38 GMT
    Server: Apache-AdvancedExtranetServer/1.3.29 (Mandrake
    Linux/1.1.100mdk) mod_perl/1.29
    Content-Length: 1163
    Content-Type: application/pdf

    %PDF-1.2

    3 0 obj
    <<
    /Length 4 0 R
>>
    stream
    BT /F1 10 Tf 32.4 744.8 Td (Brian Glass) Tj ET
    BT /F1 10 Tf 32.4 732.8 Td ( ) Tj ET
    BT /F1 10 Tf 32.4 720.8 Td (, ) Tj ET
    endstream
    endobj

    4 0 obj
    124
    endobj

    5 0 obj
    <<
    /Type /Catalog
    /Pages 6 0 R
>>
    endobj

    6 0 obj
    <<
    /Kids [1 0 R]
    /Type /Pages
    /Count 1
>>
    endobj

    7 0 obj
    <<
    /Type /Font
    /Encoding /WinAnsiEncoding
    /Subtype /Type1
    /BaseFont /Helvetica
    /Name /F1
>>
    endobj

    8 0 obj
    <<
    /Type /Font
    /Encoding /WinAnsiEncoding
    /Subtype /Type1
    /BaseFont /Helvetica
    /Name /F2
>>
    endobj

    1 0 obj
    <<
    /Kids [2 0 R]
    /Type /Pages
    /Count 1
    /MediaBox [0 0 612 792]
    /Parent 6 0 R
>>
    endobj

    2 0 obj
    <<
    /Contents [3 0 R]
    /Type /Page
    /Resources <<
    /Font <<
    /F1 7 0 R
>>
    /ProcSet [/PDF /Text]
>>
    /Parent 1 0 R
>>
    endobj

    9 0 obj
    <<
    /Type /Info
    /Producer (PDF::Create version 0.01)
    /Author (CrossTrack Church Database)
    /Title (This is a test.)
>>
    endobj

    xref
    0 10
    0000000000 65535 f
    0000000530 00000 n
    0000000626 00000 n
    0000000009 00000 n
    0000000186 00000 n
    0000000206 00000 n
    0000000256 00000 n
    0000000314 00000 n
    0000000422 00000 n
    0000000753 00000 n
    trailer
    <<
    /Size 10
    /Root 5 0 R
    /Info 9 0 R
>>
    startxref
    886
    %%EOF

Does anyone have any ideas why the browser doesn't handle this properly?
Is there something screwy in the response header?

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT