creating respons to feed into pdfcreator

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

creating respons to feed into pdfcreator

a van schijndel
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.

Can anyone point me into the right direction?
Thanks in advance

--
Greetings,
Arthur van schijndel




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: creating respons to feed into pdfcreator

mozillanerd
Is it possible that a cache is interfering? Perhaps look at the configurations.
This is just a stab in the dark. Sorry not to be more helpful




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: creating respons to feed into pdfcreator

Philippe Marschall
In reply to this post by a van schijndel
2011/1/6 a van schijndel <[hidden email]>

>
> 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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: creating respons to feed into pdfcreator

Boris Popov, DeepCove Labs (SNN)
That code is primarily to render XHTML to a string and then feed it to PRDreactor for conversion to PDF; returning of the bytes in the response is using #respond: as expected. My latest version looks like the following at the moment,

Component>>asPDF

| xhtml |
xhtml := (RenderCanvas builder)
                fullDocument: true;
                documentClass: WAHtmlDocument;
                rootBlock:
                        [:root |
                        root beXhtml10Strict.
                        root style add: (Styles default documentForFile: 'print.css').
                        root style add: 'svg {-ro-replacedelement: ''com.realobjects.xml.formatters.SVGFormatter'';}'];
                render: [:html | html render: self].
^(PDFreactorClient default convertXHTML: xhtml) bytes
 
-Boris

--
DeepCove Labs Ltd.
+1 (604) 689-0322
4th floor, 595 Howe Street
Vancouver, British Columbia
Canada V6C 2T5
http://tinyurl.com/r7uw4

PacNet Services (Europe) Ltd.
+353 (0)61 714-360
Shannon Airport House, SFZ
County Clare, Ireland
http://tinyurl.com/y952amr

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments.

Thank you.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Philippe Marschall
Sent: 09 January 2011 10:09
To: [hidden email]; Seaside - general discussion
Subject: Re: [Seaside] creating respons to feed into pdfcreator

2011/1/6 a van schijndel <[hidden email]>

>
> 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
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: creating respons to feed into pdfcreator

a van schijndel

Op maandag 10-01-2011 om 01:12 uur [tijdzone -0800], schreef Boris Popov, DeepCove Labs:
That code is primarily to render XHTML to a string and then feed it to PRDreactor for conversion to PDF; returning of the bytes in the response is using #respond: as expected. My latest version looks like the following at the moment,

Component>>asPDF

| xhtml |
xhtml := (RenderCanvas builder)
		fullDocument: true;
		documentClass: WAHtmlDocument;
		rootBlock: 
			[:root |
			root beXhtml10Strict.
			root style add: (Styles default documentForFile: 'print.css').
			root style add: 'svg {-ro-replacedelement: ''com.realobjects.xml.formatters.SVGFormatter'';}'];
		render: [:html | html render: self].
^(PDFreactorClient default convertXHTML: xhtml) bytes
 
-Boris

Thanks a lot Boris. That is exactly what I needed. I did a first quick implementation and it works for me too. Have to look into my composition of stylesheets to get it right. Maybe this code snippet can be added to the PDF faq on seaside.st?

-
Arthur


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: creating respons to feed into pdfcreator

Boris Popov, DeepCove Labs (SNN)

I don’t believe I have access to update that section, which I’d be happy to do.

 

-Boris

 

--

DeepCove Labs Ltd.

+1 (604) 689-0322

4th floor, 595 Howe Street

Vancouver, British Columbia

Canada V6C 2T5

http://tinyurl.com/r7uw4

 

PacNet Services (Europe) Ltd.

+353 (0)61 714-360

Shannon Airport House, SFZ

County Clare, Ireland

http://tinyurl.com/y952amr

 

CONFIDENTIALITY NOTICE

 

This email is intended only for the persons named in the message header. Unless otherwise indicated, it contains information that is private and confidential. If you have received it in error, please notify the sender and delete the entire message including any attachments.

 

Thank you.

 

From: a van schijndel [mailto:[hidden email]]
Sent: 10 January 2011 12:16
To: Boris Popov, DeepCove Labs
Cc: Seaside - general discussion
Subject: RE: [Seaside] creating respons to feed into pdfcreator

 


Op maandag 10-01-2011 om 01:12 uur [tijdzone -0800], schreef Boris Popov, DeepCove Labs:

 
That code is primarily to render XHTML to a string and then feed it to PRDreactor for conversion to PDF; returning of the bytes in the response is using #respond: as expected. My latest version looks like the following at the moment,
 
Component>>asPDF
 
| xhtml |
xhtml := (RenderCanvas builder)
               fullDocument: true;
               documentClass: WAHtmlDocument;
               rootBlock: 
                       [:root |
                       root beXhtml10Strict.
                       root style add: (Styles default documentForFile: 'print.css').
                       root style add: 'svg {-ro-replacedelement: ''com.realobjects.xml.formatters.SVGFormatter'';}'];
               render: [:html | html render: self].
^(PDFreactorClient default convertXHTML: xhtml) bytes
 
-Boris
 

Thanks a lot Boris. That is exactly what I needed. I did a first quick implementation and it works for me too. Have to look into my composition of stylesheets to get it right. Maybe this code snippet can be added to the PDF faq on seaside.st?

-
Arthur


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside