Printing?

6 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
    2 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
    4 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
    2 posts
    Member since:
    Jul 2018

    Posted 5 days and 7 hours ago 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
    4 posts

    Posted 5 days ago 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.
Back to Top