What's the proper way to send PostScript to a PostScript (PS) printer? I haven't found any clear documentation on the matter. Is there a raw/PS pass-through in the printer.device?
AmiPDF seems to write PS to a DOS device. That works, but it seems rather messy.
I've never done it programatically, but from a user perspective when I want to print something that's already Postscript I send it directly to the port that the printer is connected to. For me, that's LPR: (DOS level) or lpr.device (device level), since I use lpr.device to talk to my networked printer. You'd use PAR: or parallel.device if you were connected to a parallel port, etc.
The Postscript printer driver does have a pass through mode (selected by the "Driver mode" gadget in the driver's preferences), but that's just one extra step when I want to print something, so I skip the printer driver and just go directly to the port. I lose things like offline and out-of-paper detection, but that stuff doesn't work over the network anyway. I don't know if there's a way to select pass through mode from within a program.
Thanks. So, Postscript printing isn't properly supported. Having to switch manually to passthrough mode in PS prefs when printing genuine Postscript is just asking for trouble.
I think it's worth looking at porting the CUPS printing system again, or at least using its printer driver logic. IIRC, it wasn't worth it in the past because you still needed proprietary printer drivers. However, now there's the Internet Printing Protocol (IPP) standard.
It would be nice if the Postscript driver had an "automatic passthrough" mode, where if a file coming in is recognized as Postscript it is sent straight to the printer, while all other files are converted to Postscript as usual.
For most users this would allow files to just be sent to PRT: for printing, without worrying whether they were Postscript or not, and without needing to know which port the printer is connected to. For the rare user who actually wanted to print a Postscript file instead of the document it represents, they could just disable automatic mode.
The best way would be to develop/port gutenprint+cups (AFAIK amigans seem to -mistakenly?- assume that we only need gutenprint), I have looked into it and it seem's dooable... but I am wondering also if ghostscript isn't a way that is somewhat easier (especiallly postscript), using a somewhat similar way to turboprint or pagestreams own printer system which seem's similar to cups.
I think the proper way to send PostScript to a PostScript printer is in the driver. That is from the driver code itself. PostScript is similar to ESC codes and PCL in a way. As it's a custom language for an output device. ASCII as it may be for PS.
In context, what you are asking is to bypass the driver. Because, if you send PS as it is, you will get a printout of the PS code. Unless, since PS is sent as text, the PS printer will interpret the PS, but I don't know. However, if you send PS direct to a printer that is PCL, you will also get printout of PS code since it was sent text. :-)
So, your use case must be custom with a PS printer. As sending PS from an application directly to a users printer would be rather unfriendly, as it bypasses the driver, and the user will be confused unless they have an expensive PS printer as otherwise a bunch of source codes would be printed out. ;-)
That said, I think the solution to your question is the PRD_RAWWRITE command in printer.device. This command bypasses the driver. Since you want to send data directly this would be the proper way to go about it. You can use the standard commands to reset the printer to the users settings then raw write afterwards.
Of course, you can have a legitimate reason for wanting to send PS code direct, however it is generated. But, as you would be aware, this is AmigaOS and unlike Linux the printer system has no concept of accepting PS or PDF or even interpreting it or using it internally. It just has that PS output driver. The printer system is old and that's not even considering printer drivers. The user interface would be considered backwards and unfriendly in the modern age.