tojocky / node-pdfium

Native PDFium ported for node, iojs and nwjs
BSD 2-Clause "Simplified" License
72 stars 26 forks source link

EMF format not supported for all printers #5

Open pushpak opened 9 years ago

pushpak commented 9 years ago

the getSupportedOutputFormats does not return EMF format in the list. I tried for samsung laser jet printer, hp inkjet printer and epson thermal printer. Nothing returns EMF in the list.

All of them return RAW, TEXT, NT EMF 1.006, NT EMF 1.007, NT EMF 1.008 and none of them works.

tojocky commented 9 years ago

Yeah... This is an issue. I didn't find a common approach on windows yet.

Janhouse commented 8 years ago

You should look into Postscript format because probably all printers understand postscript. Right now you can convert to postscript using pdf2ps (comes with Ghostscript).

I tried converting pdf file to postscript and then print it with node-printer as "RAW" format on Windows and it worked nicely.

RobinMalfait commented 8 years ago

@Janhouse can you publish an example on how you did this? thanks

Janhouse commented 8 years ago

I didn't stick to it but I converted from pdf to ps (using pdftops that comes with Poppler) and then printed it with printer.printDirect with type set to RAW. It didn't print quickly (ps file is a lot bigger than pdf) but it worked.

Janhouse commented 8 years ago

Actually, I tried using pdfium and it did not work that well (generated EMF didn't look good (in windows viewer) and wasn't being printed).

So I ended up using exec to execute Poppler's pdftops and it generated postscript file that worked on Windows 7 in RAW mode and was printed pretty quickly.

@tojocky, maybe you could look into integrating poppler in your node module. Using exec works but it would be much cooler if it would using those libs directly. :)