Printing?

10 posts, 0 answers
  1. Michael
    Michael avatar
    19 posts
    Member since:
    Dec 2011

    Posted 15 Feb 2016 Link to this post

    Is there a printing feature to print the content inside the spreadsheet or do I need to use a print stylesheet?

     

    Thanks!

  2. Mihai
    Admin
    Mihai avatar
    153 posts

    Posted 17 Feb 2016 Link to this post

    Hi Michael,

    Client-side export to PDF is implemented.  See this demo -- click the second button in the toolbar ("Export") and select PDF instead of XLSX.

    However, I see that the API that allows to do that programmatically is not fully documented.  You can use spreadsheet.saveAsPDF(options) to get the file; the options are documented here.

    Regards,
    Mihai
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Sascha
    Sascha avatar
    4 posts
    Member since:
    Jul 2018

    Posted 13 May in reply to Mihai Link to this post

    Hello Mihai,

    this demo works fine when I "click the second button in the toolbar ("Export") and select PDF instead of XLSX". However, it does not work  every time if I use saveAsPDF() directly. Sometimes (I do not know why not every time) I just get an empty sheet (see attachment). It is more likely to get the empty sheet in Internet Explorer than in Edge. For saving as PDF I use the following code:

        <div id="spreadsheet" style="width: 100%;"></div>
        <button class="k-button k-primary" id="export_pdf" style="margin-top: 4em; float: left;">Export to PDF</button>
                 
        <script>
        $(function() {
          $("#export_pdf" ).kendoButton({
            icon: "download"
        });
          $("#export_pdf").click(function(){
          var kendoSpreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
      var firstSheet = kendoSpreadsheet.sheetByIndex(0);
      kendoSpreadsheet.activeSheet(firstSheet);
            kendoSpreadsheet.saveAsPDF({
                    area: "sheet",
                    fileName: "Printout.pdf",
                    fitWidth: true,
                    guidelines: true,
                    landscape: true,
                    hCenter: true,
                    paperSize: "A4"
                });
        });

    What is the difference between using saveAsPDF() and clicking the second button in the toolbar ("Export") and selecting PDF instead of XLSX?

    Thank you in advance!

  4. Petar
    Admin
    Petar avatar
    102 posts

    Posted 15 May Link to this post

    Hi Sascha,

    Thank you for the code snippet and the “PrintOut.pdf” file. There is no difference in using saveAsPDF() vs Using the Export button in the toolbar and selecting PDF instead of XLSX. The export functionality in the toolbar is calling the saveAsPDF().

    Based on the provided information, I would assume that the experienced issue is based on this issuе - #3525 logged in our official GitHub repository. Luckily the issue has been fixed and released with the today’s release of Kendo UI R2 2019

    Please, open this Dojo and try to reproduce the issue, you’ve reported. If everything is working fine, to avoid future unexpected behavior with the PDF export I would recommend to update the version of Kendo UI to 2019.2.514.

    Please, let me know if the above resolves your issue. 

    Regards,
    Petar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  5. Sascha
    Sascha avatar
    4 posts
    Member since:
    Jul 2018

    Posted 20 May in reply to Petar Link to this post

    Hi Petar,

    Thank you very much! With the new version of Kendo UI the export to PDF is working fine.

    After exporting to PDF the registered trade mark sign (®) is displayed as "fi" in the PDF-file. How can I export that sign correctly?

    Thank you in advance!

  6. Petar
    Admin
    Petar avatar
    102 posts

    Posted 20 May Link to this post

    Hello Sascha,

    The PDFexport needs to have access to the same fonts as the ones used by the browser to display the exportable content correctly. Based on the provided information I would assume that the PDFexport doesn’t have access to these fonts and this is why the trademark sign (®) is not displayed properly in the exported document. When there is no font set, the default one which is used for the generated document is one which uses only ASCII symbols. The trademark sign is not an ASCII symbol. More details about this issue could be read in this Pack Fonts for PDF Export article from our documentation. An example of how to apply a font for PDFexport could be found here: https://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom#custom-fonts

    Please, try to apply all of the described in the above two links and let me know if the issue still exists. 
    Looking forward to your reply.  

    Regards,
    Petar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  7. Sascha
    Sascha avatar
    4 posts
    Member since:
    Jul 2018

    Posted 12 Jul in reply to Petar Link to this post

    Hello Petar,

    I tried packing fonts but it did not work. I checked also in the examples on the Kendo UI  page. The server side PDF export there is working correctly (https://demos.telerik.com/kendo-ui/spreadsheet/server-side-pdf-export) but the client side export not (https://demos.telerik.com/kendo-ui/spreadsheet/events). I am not sure that the registered trademark sign is not an ASCII character. There are some ASCII tables containing the sign (https://theasciicode.com.ar/extended-ascii-code/registered-trademark-symbol-ascii-code-169.html). Can you change the example here https://demos.telerik.com/kendo-ui/spreadsheet/events to be able to export the sign ® ?

    Kind regards,

    Todor

  8. Petar
    Admin
    Petar avatar
    102 posts

    Posted 16 Jul Link to this post

    Hi Todor,

    Attached you will find a project based on the example you’ve linked.

    What I've done is to add the following code in the example:

    This approach is demonstrated in the link I previously sent but in the Header and Footer Templates section of the article.

    I am sending this project in an attached file, not in Dojo because there are some restrictions in the Dojo which block the loading of the additional templates. 
    Please check the attached example and let me know if you have any questions regarding the implementation. If you continue to experience the reported issue, please modify the attached project in a way the issue could be reproduced. 

    Looking forward to your reply. 

    Regards,
    Petar
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Sascha
    Sascha avatar
    4 posts
    Member since:
    Jul 2018

    Posted 09 Oct in reply to Petar Link to this post

    It works now. Thanks a lot!
  10. Petar
    Admin
    Petar avatar
    102 posts

    Posted 09 Oct Link to this post

    Hi,

    I am happy to hear that! You are welcome! 

    Regards,
    Petar
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top