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

kendo drawing off screen pdf

2 Answers 118 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kent
Top achievements
Rank 1
Kent asked on 05 Mar 2017, 09:43 PM

I tried to hide the content with absolute position outside the screen.  But the A4 size pdf has no content.  I have tried dojo with this example and also nothing is printed.  What have I missed?  PDF has content only when it is not off screen.  Thanks.

<div id="content"  style="position: absolute;left: -100000px;top:0;width:800px;">
        This is <a href="a'>http://www.telerik.com">a non-clickable link</a>.
    </div>
    <script>
        var draw = kendo.drawing;
        draw.drawDOM($("#content"), {
            avoidLinks: true,
            paperSize: "A4"
        })
        .then(function(root) {
            return draw.exportPDF(root);
        })
        .done(function(data) {
            kendo.saveAs({
                dataURI: data,
                fileName: "avoid-links.pdf"
            });
        });
    </script>

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 07 Mar 2017, 11:45 AM
Hello Kent,

PDF export respects the styles applied to an element. So, if you want to make the image visible, you can use the k-pdf-export class, which is only applied during export, to overwrite the position setting for the PDF document. This approach is explained here: The .k-pdf-export Class.

Following you can see a Dojo with your code and the position overwritten during export:
http://dojo.telerik.com/@tsveti/iQiRa/3

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Bertha
Top achievements
Rank 1
answered on 07 Mar 2017, 03:11 PM
Thanks. working.
Tags
General Discussions
Asked by
Kent
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Bertha
Top achievements
Rank 1
Share this question
or