node-pdfium icon indicating copy to clipboard operation
node-pdfium copied to clipboard

EMF format not supported for all printers

Open pushpak opened this issue 10 years ago • 5 comments

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.

pushpak avatar May 24 '15 11:05 pushpak

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

tojocky avatar May 26 '15 15:05 tojocky

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.

Janhouse avatar Aug 08 '15 08:08 Janhouse

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

RobinMalfait avatar Oct 02 '15 23:10 RobinMalfait

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 avatar Oct 26 '15 12:10 Janhouse

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. :)

Janhouse avatar Oct 26 '15 20:10 Janhouse