Hi,
I'm playing with wkhtmltopdf that can convert html/css into a PDF file. If anyone is interested it can be found here: http://code.google.com/p/wkhtmltopdf/. It should run on Windows and Linux (I've tested it on Windows). It is run as a command line program. You give it a URL or html input filename and an output pdf filename (where it writes the pdf file). So far I like it but it would be nice if it broke pages at table row and not in the middle of a row. Now to my question. What is the best way to deliver the file for download? I can put the file where Apache can download it. Or I can read it into a string and serve it up from Seaside. If I go the Apache route, how would I automatically trigger the download after creating the file? If I serve it from Seaside, how do I do that? Many thanks in advance, Lou ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Louis,
Once you have the bytes in hand the following should do the trick, self requestContext respond: [:response | response document: ((#[1 2 3] seasideMimeDocument) mimeType: 'application/pdf'; fileName: 'report.pdf'; yourself)]. -Boris -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Louis LaBrunda Sent: Friday, July 08, 2011 10:02 AM To: [hidden email] Subject: [Seaside] File for download Hi, I'm playing with wkhtmltopdf that can convert html/css into a PDF file. If anyone is interested it can be found here: http://code.google.com/p/wkhtmltopdf/. It should run on Windows and Linux (I've tested it on Windows). It is run as a command line program. You give it a URL or html input filename and an output pdf filename (where it writes the pdf file). So far I like it but it would be nice if it broke pages at table row and not in the middle of a row. Now to my question. What is the best way to deliver the file for download? I can put the file where Apache can download it. Or I can read it into a string and serve it up from Seaside. If I go the Apache route, how would I automatically trigger the download after creating the file? If I serve it from Seaside, how do I do that? Many thanks in advance, Lou ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ 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 |
Hi Boris,
Thanks for the really fast response, I will give it a try. Lou >Louis, >Once you have the bytes in hand the following should do the trick, >self requestContext respond: > [:response | > response document: ((#[1 2 3] seasideMimeDocument) > mimeType: 'application/pdf'; > fileName: 'report.pdf'; > yourself)]. > >-Boris ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Louis LaBrunda
we use XSendFile
On Jul 8, 2011, at 11:01 AM, Louis LaBrunda wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Hi Boris,
This works great! Sorry for not saying so sooner. Is there a way to get the download to open in another browser window/tab? Some browsers do, some don't. Lou >Louis, >Once you have the bytes in hand the following should do the trick, >self requestContext respond: > [:response | > response document: ((#[1 2 3] seasideMimeDocument) > mimeType: 'application/pdf'; > fileName: 'report.pdf'; > yourself)]. >-Boris ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
You could try specifying #target: of the anchor (if it's the anchor that
has your callback), but really I wouldn't worry much about that aspect of browser behavior given that you'll never have full control of it. -Boris -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Louis LaBrunda Sent: Friday, July 22, 2011 11:16 AM To: [hidden email] Subject: [Seaside] File for download Hi Boris, This works great! Sorry for not saying so sooner. Is there a way to get the download to open in another browser window/tab? Some browsers do, some don't. Lou >Louis, >Once you have the bytes in hand the following should do the trick, self >requestContext respond: > [:response | > response document: ((#[1 2 3] seasideMimeDocument) > mimeType: 'application/pdf'; > fileName: 'report.pdf'; > yourself)]. >-Boris ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ 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 |
Hi Boris,
Thanks for the amazingly fast response! Are you just sitting around waiting for me to ask you dumb questions:) I think this is good advice, I was slowing coming to the same conclusion. Lou >You could try specifying #target: of the anchor (if it's the anchor that >has your callback), but really I wouldn't worry much about that aspect >of browser behavior given that you'll never have full control of it. >-Boris ----------------------------------------------------------- Louis LaBrunda Keystone Software Corp. SkypeMe callto://PhotonDemon mailto:[hidden email] http://www.Keystone-Software.com _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |