ngx-print icon indicating copy to clipboard operation
ngx-print copied to clipboard

Is there any possibility to set the orientation to landscape?

Open mwimmer-bcx opened this issue 2 years ago • 1 comments

Is there any possibility to set the orientation to landscape? It would be good, if there would be a possibility to set the orientation. Maybe via parameter but it is up on you.

Is there any way to do it with a workaround right now? Maybe some css @page @media?

Kind regards, Manuel

mwimmer-bcx avatar Mar 18 '22 07:03 mwimmer-bcx

I had the same request, but solved for me with the following.

  1. When I do not apply css using [useExistingCss]="true", the Layout dropdown option (portrait or landscape) is present when trying to print.
  2. My css contains a @media print{@page {size: landscape}} line, but it seems to be ignored by ngx-print.
  3. If I use {size: landscape !important}, it will print in landscape. 4. If I use {size: auto !important}, the Layout option is provided.

For 1 and 2 above, the print screen will briefly flash a screen including the Layout option, but it is removed within a second. This behavior occurs in both Chrome and Edge.
Chrome Version 99.0.4844.82 (Official Build) (64-bit)
Microsoft Edge Version 99.0.1150.46 (Official build) (64-bit)

cliffeby avatar Mar 24 '22 19:03 cliffeby

Hey 👋 To do this I combined the two options in this way:

 [printStyle]="{ '@page': { size: 'landscape !important' } }"
 [useExistingCss]="true"

kapik avatar May 11 '23 19:05 kapik