MatteoMeil / node-native-printer

Node module to print from nodejs apps
83 stars 41 forks source link

How to print html file #17

Closed manhnguyenquoc closed 5 years ago

manhnguyenquoc commented 5 years ago

Describe the bug I try to print a html file but it prints like a raw text without rendering any html tags. How can I fix this?

To Reproduce This is my nodejs code:

printer.setPrinter('SLK-TE203'); printer.print('E:/index.html', {paperSize: 'Custom.270x270', color: false});

This is my html:

Captur2e

And the result: Untitl2ed

OS

Packages

MatteoMeil commented 5 years ago

node-native-printer is not intended to render and print, but only to print raw files. So, printing an HTML will output raw tags.

If you need to render your HTML first, you can take a look at this package: you can generate and save a temporary PDF and print it

felipe-gustavo commented 4 years ago

@MatteoMeil, has a method to render HTML before print, I want make a feature, but I don't have idea where to start in right method, render HTML in pdf and print the pdf is right method to solve this?

MatteoMeil commented 4 years ago

Yes, it's the only method to print a rendered HTML page by now. This plugin is meant to pront files as-is, so it does not provide any kind of preprocessing or rendering. I'm currently non maintaining the repository but I planned to bugfix it and make some improvement, including HTML rendering, but I don't know when I'll can. I'm sorry

Il mar 20 ott 2020, 14:29 Felipe Gustavo notifications@github.com ha scritto:

@MatteoMeil https://github.com/MatteoMeil, has a method to render HTML before print, I want make a feature, but I don't have idea where to start in right method, render HTML in pdf and print the pdf is right method to solve this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MatteoMeil/node-native-printer/issues/17#issuecomment-712814142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDW4JNMILPOJEAOAZFCI4DSLV7B7ANCNFSM4HSESYAQ .