1

Is there a way to switch an HTML page to "print" mode?

When I print, a @media print style-sheet gets applied to the page.

I want to use the page with that print style applied to export to PDF as well. Ideally, if I could get the HTML that gets sent to the printer when I use window.print() I could export it to PDF. I use a server side library and C# to export to PDF.

Any ideas on how I can do this?

Thank you!

Matei
  • 327
  • 5
  • 17

1 Answers1

0

As per W3C standars there is no distinctive print mode for web pages except that you can define different CSS rules for @screen and @print media.

If you want to render a page as it is shown in print view somewhere it is show in screen view; use @print CSS for @screen also.

XIMRX
  • 2,130
  • 3
  • 29
  • 60