Export PDF Export file orientation

1 Answer 876 Views
PDF Export Scheduler
carina
Top achievements
Rank 1
Iron
carina asked on 25 Mar 2022, 05:18 PM

Hi team,

I'm trying to force a different orientation for the PDF file exported.

I tried this:

        <kendo-pdf-export #pdfExport [landscape]="false">
            <kendo-scheduler-pdf fileName='Vergabekalender.pdf' margin='1cm' [avoidLinks]="true">
            </kendo-scheduler-pdf>
        </kendo-pdf-export>

 

I set the landscape attribute for forcing the portrait orientation. But after the export, I always get the scheduler in landscape orientation.

Could you please help me here? :)

Thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Hetali
Telerik team
answered on 25 Mar 2022, 08:42 PM

Hello Carina,

The Kendo UI Scheduler PDF Export does not have a built-in orientation. Based on the width of the Scheduler, the PDF Export of the Scheduler is either narrow or wide.

In order to get a portrait-like PDF Export, the width of the Scheduler can be changed to a particular width before the export and can be changed back to the original width after the export. For example:

<kendo-scheduler id="scheduler" #scheduler>
  <ng-template kendoSchedulerToolbarTemplate>
    <button kendoButton (click)="exportToPDF(scheduler)">Export PDF</button>
  </ng-template>
</kendo-scheduler>

public exportToPDF(scheduler) {
  var schdlr = document.getElementById("scheduler");
  var width = schdlr.clientWidth;
  schdlr.style.width = '794px';
  scheduler.saveAsPDF();
  setTimeout(() => {
    schdlr.style.width = width + 'px';
  });
}

In this StackBlitz example, the Kendo UI Scheduler PDF is exported in a portrait-like view irrespective of the width of the Scheduler.

I hope this helps.

Regards,
Hetali
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

carina
Top achievements
Rank 1
Iron
commented on 28 Mar 2022, 09:16 AM

Hi Hetali,

Thank you for all details.

Regards,

Carina Gomes

carina
Top achievements
Rank 1
Iron
commented on 28 Mar 2022, 10:53 AM

Hi Hetali,

Just one more question:
What does the landscape attribute do?

Thank you.

 

Hetali
Telerik team
commented on 30 Mar 2022, 04:30 PM

Hi Carina,

The landscape attribute is used in the Kendo UI PDF Export Component. The PDF Export Component does not export the entire Scheduler (as scrolling is not available in PDF). The Kendo UI Scheduler has a separate PDFComponent so that it can export the entire scheduler in a PDF and has it's own attributes (landscape is not an attribute of the PDFComponent). 

I hope this answers the question. Please let me know if you have any further questions.

Regards,
Hetali
Progress Telerik
carina
Top achievements
Rank 1
Iron
commented on 31 Mar 2022, 09:55 AM

Hi Hetali,

For now, seems your first solution is enough.

Thank you for all information.

Best regards,

Carina

 

 

Tags
PDF Export Scheduler
Asked by
carina
Top achievements
Rank 1
Iron
Answers by
Hetali
Telerik team
Share this question
or