Windows convert text file to postscript and print - windows

In Windows how can I use RedMon EE , Ghostscript, GSview , Nenscript for Windows to convert a text file to postcript and redirect it to a printer .
Something like to configure "RPT1: Redirected Port"
with the values
C:\Program Files\Ghostgum\gsview\gsprint.exe
for the "Redirect this port to the program" and
-printer "Windows Printer Name" -copies 1 - for "Arguments"
and additionally use enscript in order to receive a text file as input .

You don't need most of those.
Apprently nenscript can convert text files to PostScript, so use nenscript to do that. Then use Ghostscript and specifically the mswinpr2 device to render to a Windows printer.
Of course, if the printer understand PostScript you don't even need to use Ghostscript, you can simply send the PostScript program direct to the printer.
You're also pointing to a very old version of Ghostscript there, 8.64, you really want to be using the current version 9.27 which is available from www.ghostscript.com. Version 8.64 is 10 years old now.
Edit
If it's a GDI printer then you need to get Windows to package the data and send it to the printer, using the Windows printer driver. To do that you need to have Ghostscript render the input to an image, then send the bitmap to the Windows printing pipeline using the mswinpr2 device.
So use nenscript to create the PostScript file (let's call it input.ps) then something like
gswin64c -sDEVICE=mswinpr2 -sOutputFile=%printer%My_Printer input.ps
The documentation for the Windows printing device can be found here.

Related

Zebra printer prints zpl code instead of label

Zebra printer is connected to CUPS server and I am sending prints using IPP. When I parse zpl file and fill data using a parser it prints correctly, but when I directly try to print zpl with data using IPP it just prints it as plaintext.
Yeah, I was able to solve the issue. The problem was that the printer was not set to accept the raw zpl and print it. I had to set the printer to raw and it worked. Thanks.
If anyone still facing this issue here are the steps we followed to setup the ZPL printer.
Start the cups server and access the web interface via http://localhost:631/
Add printer
Choose your local printer (your printer should be listed)
press continue
Provide name, description and enable the share checkbox
continue
Choose the Make as 'RAW' please refer to the attached snapshot.
Add the printer.
It should print the label instead of raw ZPL.
Make sure you are using a generic text based print driver to print the ZPL.

Printing on the FILE port with a given output path still shows the "save as" dialog

My application uses GDI printing to create postscript files then converted to PDF.
My printer use Ghostscript PDF driver and the FILE port
(By the way why it is named "PDF driver" if it cannot output pdf directly)
I specify a file output path with the DOCINFO struct docInfo.lpszOutput = L"c:\temp_path\{guid}.ps";
Everything works fine. But sporadically the driver prompt the "save as" dialog, despite I provided an output filename.
The program runs server side so this prompt dialog is problematic.
Why does this happen?

Zero byte PDF saved when I use saveas in PowerBuilder web application

I'm using PowerBuilder 12.5 nd installed ghostscript 9.19 version then I configured Sybase DataWindow PS printer using ghostscript driver.
I checked the registry it was pointing to the ghostscript DLL,bin and lib folders.
In datawindow painter window selected the PDF data export type,distill method and check the PostScript custom check box.
When I click save rows as in painter it is creating the PDF file with rows and also if I use dw_1.print the file was created in print manager without any issue.
But problem is when I use DW_1.saves("custom.pdf",PDF!,true) it is saving 0 bytes file in the file manger directory. Any suggestions?
I want save the datawindow in PDF format and it should be opened automatically because I don't want to go to print manager to print the file when I use print function.
Save the PostScript file and then run it through Ghostscript from the command line. Likely there is some error being returned which PowerBuilder isn't telling you.
Of course, you could also ask Sybase for assistance, since they supply it. Relying on open source software for their PDF export is (it seems to me) somewhat cheeky.....
You should use the Ghostscript that is provided with PB, using any other version is prone to fail...
For PB12.5, it is 8.71.
You can look at this other answer for further help: https://stackoverflow.com/a/15854193/317266
1.I Installed latest ghostscript driver and Mapped it as "Sybase DataWindow PS" Postscript Printer.
2. Then I used Distill method to save the datawindow in PDF format but saveas method returns -1.
3.In the IIS Manager -> Application Pools -> select PBDOTNETAPPPOOL -> go to advanced settings -> Navigate to process model and change the identity to Networkservice from applicationpoolidentity.
After that i'm able to save the datawindow in PDF format successfully!!!

Copy Pillow image to GIMP through X11 clipboard

I'm using Xubuntu 14.04 (an X11/Linux distribution). I've written a Python program using the Pillow (Python Imaging Library) and Tkinter libraries to render user-entered text into an image using a custom bitmap font. I want to quickly bring this image into the running GIMP process as a new layer. Currently it operates by saving the image to a PNG file and then requiring the user to go dig for the PNG file using GIMP's file picker. I thought it would be more convenient if I could save the image to the X11 clipboard so that I could paste it into GIMP.
But all the examples for interacting with the clipboard in Tkinter that I could find through Google are for text, not images. I found how to copy an image in Windows (1, 2): save a BMP file to a BytesIO, chop off the first 14 bytes, and send the rest to the Windows clipboard as a CF_DIB. But I don't want to require Wine. There also exists an answer about how to do it in GTK+; is it worth porting the application from Tkinter to PyGTK (for GTK+ 2) or PyGObject (for GTK+ 3), despite the installation headache that it may cause for Windows users? Or is there an easier way than the X11 clipboard to get a PIL.Image.Image instance into GIMP?
You can send an image to an open GIMP process by using its "remote" feature. If GIMP is already running, the command gimp path/to/file.png finds GIMP's window and drops the image into the running process. This means you can create a folder with tempfile.TemporaryDirectory, save the image into this folder, and open it in GIMP.
tempfile.TemporaryDirectory is new in Python 3.2 and not available in Python 2. tempfile.NamedTemporaryFile is available in older versions of Python, but the tempfile module docs state that on UNIX, the filename can be passed to another program, but on Windows, the temporary file cannot be opened by other programs while it is open in the program that created it, and once the program that created it closes it, it will already have been deleted. Windows users with both Python 2 and Python 3 installed will need to use Python 3.3 or later in order to let the shebang line processor (PEP 397) select the appropriate version of Python.
Or if you don't want to depend on Python 3.3 or later, you could have your program detect whether it's running on Windows or POSIX and then make the appropriate action available. Under Windows, it would copy the image to the clipboard, and under POSIX, it would write the image to a tempfile.NamedTemporaryFile, pass the filename to gimp or whatever other program the user specifies to receive it, and then destroy the temporary file once a new one is created or the application closes.

How to bypass media selection command to printer when using Ghostscript rip ps files?

I am trying to use GhostScript to rip PostScript files first on computer and then forward them to a ricoh MP1350 printer through USB connection, but failed. So I hereby ask for help. The detail is as following.
Followed the instructions provided on www.stat.tamu.edu/~henrik/GSPSPrinter/GSPSprinter.html, I succeeded in building a virtual PS printer on a PC with Win7.
I setup the virtual PS printer with MP1350 PS driver, creating the redirect port RPT1 with argument told by the instruction and in help with RedMon, all printing data were forwarded to the real MP1350 device connected with the PC through USB.
It DOES work when dealing with common printing jobs. However, when I send PostScript files containing MP1350's media selection commands, it seems fail to tell the printer to fetch paper in tray 2 or 3 or 4 as told in that PS file. All pieces of paper are fetched in tray 1.
The print command is:
copy /b sample.ps \\127.0.0.1\gspspr
in which "gspspr" is the printer name of the virtual PS printer, with MP1350 PS driver Ver3.1(latest) installed. "sample.ps" is the postscript file I mentioned above.
The arguments file "mswinpr2.txt" is written as follow:
-Ic:\gs\gs9.05\lib
-sDEVICE=mswinpr2
-dNoCancel
-dNOPAUSE
-dSAFER
-dMaxBitmap=400000000
-dBufferSpace=400000000
-dNumRenderingThreads=2
-dMaxPatternBitmap=80000000
-sPAPERSIZE=a4
With the same PostScript file "sample.ps", if I send it using this command:
copy /b sample.ps \\127.0.0.1\gsprinter
in which "gsprinter" is the name of real MP1350 connected through USB, with MP1350 PS driver Ver3.1(latest) installed. The printer MP1350 can tell those media selection commands and fetch paper from tray 2 or 3 or 4 as told.
All the driver settings of these two devices are the same, and I set output protocol to "TBCP" in "Device Settings" tab.
So please help me to tell, why the printer fails to select the certain media trays when I use gs to rip that ps file? And how to solve it?
With great appreciation!
The PostScript file contains the media and tray selection command,s if you send the PostScript to the printer directly, then those commands are acted upon by the printer.
When you use Ghostscript, you are actually rendering the PostScript to a bitmap, which the mswinpr2 device forwards to the windows printing system. The final printer can be anything, it need not be a PostScript printer. However you can't embed tray selection commands in the bitmap, so there is no way to preserve that request form the original job.
There is no way to 'solve' this, its in the nature of the process.
Given that your printer clearly accepts PostScript directly why are you even using Ghostscript at all ?
If your printer understands PCL5 or PCL6, you can rip your files through ghostscript and have ghostscript mapping the postscript MediaPosition to trays in HP-like printers.
Two of the ghostscript drivers - ljet4 (or one of the pcl5? ones) and pxlcolor,
can map postscript mediaposition to HP media trays. See also discussion on the InputAttributes dictionary and the -dNOMEDIAATRS switch, however. http://bugs.ghostscript.com/show_bug.cgi?id=693053

Resources