[Seaside] creating respons to feed into pdfcreator

Philippe Marschall philippe.marschall at gmail.com
Sun Jan 9 10:09:13 UTC 2011


2011/1/6 a van schijndel <avanschijndel at oxius.nl>
>
> Hi,
>
> I am updating my application to seaside30. To create pdf I use prince2 executable.  The htmlcontent to feed into the prince executable is created with  a construction as described in http://www.seaside.st/documentation/pdfs in the section of pdfReactor at message asPDF .
> I am trying to understand how to do this in seaside30 but have trouble to find a way to do it now the respons is generated using a notification and response is only accessible via (current)requestContext.
>
> original example:
>
> asPDF
>   | handler response |
>   handler := WARenderContinuation root: (PDFRoot for: self).
>   response := WAResponse new.
>   handler context: (WARenderingContext new session: self session; actionUrl: WAUrl new; yourself).
>   handler processRendering: response.
>   ^(PDFReactorClient default convertXHTML: response contents contents) getPDF.

That's really strange code. I would do something like this:

answerPdf
    self requestContext respond: [ :response |
        response
            contentType:'application/pdf'
            attachmentWithFileName:'usecase.pdf';
            binary;
            nextPutAll: thePdf ]


renderContentOn: html
    html anchor
        callback: [ self answerPdf ]
        with: 'donload PDF'

However that doesn't cover how the PDF is actually created. I have no
idea how PDFReactor works, does it render the current or an other page
as HTML send it to a server and get it back as PDF?

Cheers
Philippe


More information about the seaside mailing list