search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to customize title when using print()?

Asked by Ethan
1 year ago.

Hi team,

I added print() for my Gantt Chart but the default title is "Scheduler".
I saw the printing demo has a customized title "Printing (JavaScript Scheduler) | DayPilot Pro for JavaScript Demo
".
https://javascript.daypilot.org/demo/scheduler/exportprint.html
But I could not find out how to do it.
Could you please advise?

Thank you very much!

Answer posted by Dan Letecky [DayPilot]
1 year ago.

The print() method uses the title of the current page when printing.

You can temporarily override the title like this:

const oldTitle = document.title;
document.title = "My Scheduler";
dp.exportAs(format).print();
document.title = oldTitle;

If you need full control over the layout of the output page, I recommend exporting the Scheduler to PDF:
https://doc.daypilot.org/scheduler/client-side-pdf-export/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.