Hi,
I am investigating the export PDF feature in SmartClient using Canvas exportContent() . We are still on version 8.2 (v8.2p_2013-03-07/Pro Development Only) but I have also tried version 8.3 (v8.3p_2013-02-14/Pro Development Only).
What we essentially want to be able to do is export a PDF with a mixture of SmartClient components and our custom HTML components such as our header and footer with any custom CSS styles for the header and footer. I have been able to (sort of) achieve this in a simple example by doing the following:
1. Defining a new class that extends Canvas and overriding getInnerHTML() to return the page header HTML and the HTML for a Canvas (contentLayout) that contains a TreeGrid and a ListGrid by calling getPrintHTML() on the Canvas:
2. Creating an instance of MyPrintCanvas and setting autoDraw to false so that it isn't drawn on the screen since it is added just so I can export to PDF.
3. Calling RPCManager.exportContent on the printCanvas to export to PDF:
Questions:
1. Am I on the right track with this approach for exporting a mixture of HTML and SmartClient components to PDF?
2. How do I make MyPrintCanvas recognize custom CSS? I have CSS on the page for the pageHeader element, for example. However, the PDF doesn't recognize this CSS and just displays the text 'My Header'.
3. In this example, it doesn't seem to make much of a difference, but when would it be better to use PrintCanvas versus Canvas?
4. Is there a better way to get a reference to the html content instead of copying the html string in getInnerHTML() manually? The HTML content could be more complicated than a simple div.
Thanks,
Mehak
I am investigating the export PDF feature in SmartClient using Canvas exportContent() . We are still on version 8.2 (v8.2p_2013-03-07/Pro Development Only) but I have also tried version 8.3 (v8.3p_2013-02-14/Pro Development Only).
What we essentially want to be able to do is export a PDF with a mixture of SmartClient components and our custom HTML components such as our header and footer with any custom CSS styles for the header and footer. I have been able to (sort of) achieve this in a simple example by doing the following:
1. Defining a new class that extends Canvas and overriding getInnerHTML() to return the page header HTML and the HTML for a Canvas (contentLayout) that contains a TreeGrid and a ListGrid by calling getPrintHTML() on the Canvas:
Code:
isc.defineClass("MyPrintCanvas", "Canvas").addProperties({ getInnerHTML: function() { return "<div id='pageHeader'>My header</div>" + contentLayout.getPrintHTML(); } });
Code:
isc.MyPrintCanvas.create({ ID: "printCanvas", autoDraw: false });
Code:
isc.Button.create({ ID: "pdfPrint", title: "PDF Print", click:function () { var settings = { skinName: "Enterprise", pdfName: "export"// without .pdf }; isc.RPCManager.exportContent(printCanvas, settings); } });
1. Am I on the right track with this approach for exporting a mixture of HTML and SmartClient components to PDF?
2. How do I make MyPrintCanvas recognize custom CSS? I have CSS on the page for the pageHeader element, for example. However, the PDF doesn't recognize this CSS and just displays the text 'My Header'.
Code:
<style> #pageHeader { height: 20px; width: 100%; border-style:solid; border-width:5px; } </style>
4. Is there a better way to get a reference to the html content instead of copying the html string in getInnerHTML() manually? The HTML content could be more complicated than a simple div.
Thanks,
Mehak
Comment