pedro-lucas / node-pdfbox

Node bridge module to library PDFBox
MIT License
19 stars 13 forks source link

How can I do printing #3

Closed jochenonline closed 7 years ago

jochenonline commented 7 years ago

How can printing be achieved like in these examples?

pedro-lucas commented 7 years ago

I will create a example in the next weekend.

pedro-lucas commented 7 years ago

Did you try archive this using https://github.com/tojocky/node-printer?

If this doesn't work, I can implement the print method inside page for you.

jochenonline commented 7 years ago

As I understood pdfbox and node-printer both to pdf rendering into some printer compatible format. pdfbox does it by itself and node-printer uses imagemagic. I want to use pdfbox, so using node-printer seems to me to be the wrong way. Or did I get something wrong?

pedro-lucas commented 7 years ago

Yes, you are right. I will create the print method for you. :)

pedro-lucas commented 7 years ago

@jochenonline

I wrote some exemples to print a pdf using pdfbox library.

https://github.com/pedro-lucas/node-pdfbox/tree/master/examples/print

I tested these examples in Windows, Linux and OSx. I had trouble with headless in OSx, please, make a new test in OSx, maibe it's a miss configuration in my OSx.

Erro in OSx java.awt.print.PrinterException: No print service found. at sun.lwawt.macosx.CPrinterJob.print(CPrinterJob.java:239) at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1331) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)

pedro-lucas commented 7 years ago

@jochenonline

Sorry for the delay in the answer.

pedro-lucas commented 7 years ago

Written sample code