San Jaisy
San Jaisy

Reputation: 17048

ngx-print with custom css file

I am using ngx-print to perform the print action with css file, however, css is not working. Here is the example.

https://stackblitz.com/edit/demo-ngx-print-fmiwwr

Library reference.

https://www.npmjs.com/package/ngx-print

<button printSectionId="demo"
styleSheetFile="assets/css/print.css"
 ngxPrint>print</button>

All the css are in the print.css file.

Upvotes: 1

Views: 7321

Answers (3)

MUHAMMED ASHKAR P.A
MUHAMMED ASHKAR P.A

Reputation: 1

I also faced the same issue.try to give the CSS file in the assets folder itself, it won't work when we give the CSS in any other file.solved my issue.

<button printSectionId="print-section" class="btn save" printTitle="printHeading" styleSheetFile="assets/css/print-pdf.css" [useExistingCss]="true" ngxPrint>Print</button>

Upvotes: 0

Djamel eddine CHAHRAT
Djamel eddine CHAHRAT

Reputation: 145

please try to add this code, it works nicely for me

[useExistingCss]="true"

so it will be like this

<button [useExistingCss]="true" printSectionId="print-section" ngxPrint>print</button>

Upvotes: 2

Krit Sandhu
Krit Sandhu

Reputation: 1

I could fix your example by updating the ngx-print

"ngx-print": "^1.2.0-beta.5",

Upvotes: 0

Related Questions