This is a migrated thread and some comments may be shown as answers.

Printing?

9 Answers 83 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 15 Feb 2016, 06:19 PM

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

 

Thanks!

9 Answers, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 17 Feb 2016, 12:11 PM
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!
 
0
Sascha
Top achievements
Rank 1
answered on 13 May 2019, 02:33 PM

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!

0
Petar
Telerik team
answered on 15 May 2019, 01:49 PM
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.
0
Sascha
Top achievements
Rank 1
answered on 20 May 2019, 08:15 AM

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!

0
Petar
Telerik team
answered on 20 May 2019, 02:54 PM
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.
0
Sascha
Top achievements
Rank 1
answered on 12 Jul 2019, 11:10 AM

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

0
Petar
Telerik team
answered on 16 Jul 2019, 10:37 AM
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.
0
Sascha
Top achievements
Rank 1
answered on 09 Oct 2019, 09:16 AM
It works now. Thanks a lot!
0
Petar
Telerik team
answered on 09 Oct 2019, 10:28 AM

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.
Tags
Spreadsheet
Asked by
Michael
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Sascha
Top achievements
Rank 1
Petar
Telerik team
Share this question
or