简体   繁体   中英

Kendo UI PDF Export component for Angular

I'm using Kendo for exporting a component into PDF. The problem is it doesn't print properly and the PDF generator can't handle some elements on my page. Can I resolve this or do I need to make a separate view for this PDF generator?

Kendo pdfexport 我要导出的组件 导出的pdf文件

I guess you can use a Page Template to customize your PDF output. I´m not sure which elements are not handle properly but definitely you have more power with page template.

All you need is to nest a <ng-template> tag with the kendoGridPDFTemplate directive inside the <kendo-grid-pdf> component.

Here is a Telerik example: https://stackblitz.com/run/

and some documentation: https://www.telerik.com/kendo-angular-ui/components/grid/export/pdf-export/#toc-specifying-page-template

Seems like you are missing some font. Do you have it added in your domain? Check this link: https://www.telerik.com/kendo-angular-ui/components/pdfexport/embedded-fonts/

Also, if you want to change only the style of the printed view, you can use the .k-pdf-export class in your css to change the view as you wish, without having to change all the page. For example, hidden the buttons:

.k-pdf-export button {
   visibility: hidden; 
}

Live example here:

https://stackblitz.com/edit/angular-stack-55588085-printpdf?file=styles.css

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM