<html><head></head><body><div class="ydp2ec289a2yahoo-style-wrap" style="font-family:lucida console, sans-serif;font-size:13px;"><div></div>
        <div dir="ltr" data-setdir="false">Thanks <span>Maringolo</span>, </div><div dir="ltr" data-setdir="false">That is exactly what I was looking for. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Bob </div><div dir="ltr" data-setdir="false"><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_8229940512" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Wednesday, August 12, 2020, 09:33:48 a.m. EDT, Esteban Maringolo <emaringolo@gmail.com> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">Hi Bob,<br clear="none"><br clear="none">I have a report generator and I've been using wkhtml2pdf [1] to<br clear="none">generate the PDF files. It supports CSS... and JavaScript!  And has a<br clear="none">lot of print related tweaks.<br clear="none">The good thing is that this enables the user to "view" the content<br clear="none">generated in the browser and then download it as PDF with minimal<br clear="none">modifications.<br clear="none">For that I have a stylesheet that is optimized for printing.<br clear="none"><br clear="none">There is a commercial alternative called PrinceXML [2] that is the<br clear="none">best option I know for doing the same as the above, but with many more<br clear="none">supported options (like keeping some content together when printing,<br clear="none">etc.). I remember contacting them years ago, but the pricing was too<br clear="none">high for my customer and the project I was working at. The owner was<br clear="none">one of the creators of Opera Browser and CSS3 itself AFAIR.<br clear="none"><br clear="none">Another option, that I'm considering for a new project, is to use<br clear="none">Headless Chromium [3], that I expect would produce a similar output as<br clear="none">that of a Chromium based rendering.<br clear="none"><br clear="none">To generate the input to be passed to wkhtml2pdf I simply instantiate<br clear="none">a WAHtmlCanvas and then render components the usual way, but the<br clear="none">stream is a temporary file which I then pass as argument to<br clear="none">wkhtml2pdf.<br clear="none"><br clear="none"> ( Seaside.WAHtmlCanvas builder )<br clear="none">   fullDocument: true;<br clear="none">   rootBlock:<br clear="none">     [ :html |<br clear="none">       html meta charset: 'utf-8'.<br clear="none">          "html stylesheets..."<br clear="none">           html title: self reportElement title , ' - ' , self<br clear="none">applicationName ];<br clear="none">      render: [ :html | self renderReportContentOn: html ].<br clear="none"><br clear="none">The good thing is I can reuse existing components such as WAReport or my own.<br clear="none">I was thinking of creating my own visitor that does something other<br clear="none">than `renderContentOn:` (like #renderPrintContentOn:`), but then this<br clear="none">worked and other requirements came by, and never got back to it.<br clear="none"><br clear="none">Regards,<br clear="none"><br clear="none">[1] <a shape="rect" href="https://wkhtmltopdf.org/" target="_blank">https://wkhtmltopdf.org/</a><br clear="none">[2] <a shape="rect" href="https://www.princexml.com/" target="_blank">https://www.princexml.com/</a><br clear="none">[3] <a shape="rect" href="https://developers.google.com/web/updates/2017/04/headless-chrome" target="_blank">https://developers.google.com/web/updates/2017/04/headless-chrome</a><br clear="none"><br clear="none">Esteban A. Maringolo<br clear="none"><div class="yqt1043178044" id="yqtfd59644"><br clear="none">On Wed, Aug 12, 2020 at 10:06 AM Bob Nemec <<a shape="rect" ymailto="mailto:bobn@rogers.com" href="mailto:bobn@rogers.com">bobn@rogers.com</a>> wrote:<br clear="none">><br clear="none">> There a number of tools for converting web content to a PDF.<br clear="none">> Has anyone used one from within Seaside?<br clear="none">> I'd like to generate a PDF from a div, not the entire page.<br clear="none">><br clear="none">> We already use PDF4Smalltalk and Report4PDF with a rudimentary HTML parser.<br clear="none">> It can create PDF content for HTML that has bold, underline and italic markup.<br clear="none">> Users use this to add content to reports. Report4PDF can render the user content either as HTML or generate a PDF.<br clear="none">> Complex content, like tables and images, is not supported. And I have not interest in adding support.<br clear="none">><br clear="none">> For code generated content Report4PDF works fine. But for user entered content it is not optimal.<br clear="none">> I'd rather use something that can represent complex user content.<br clear="none">><br clear="none">> Anyone have experience with this?<br clear="none">><br clear="none">> Thanks,<br clear="none">> Bob Nemec</div><br clear="none">><br clear="none">> _______________________________________________<br clear="none">> seaside mailing list<br clear="none">> <a shape="rect" ymailto="mailto:seaside@lists.squeakfoundation.org" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br clear="none">> <a shape="rect" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br clear="none">_______________________________________________<br clear="none">seaside mailing list<br clear="none"><a shape="rect" ymailto="mailto:seaside@lists.squeakfoundation.org" href="mailto:seaside@lists.squeakfoundation.org">seaside@lists.squeakfoundation.org</a><br clear="none"><a shape="rect" href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><div class="yqt1043178044" id="yqtfd65828"><br clear="none"></div></div></div>
            </div>
        </div></body></html>