leecher1337 / ntvdmx64

Run Microsoft Windows NTVDM (DOS) on 64bit Editions
820 stars 81 forks source link

solution to Printing LPT port in Window 11x64 22H2 22621.2134 #245

Open Reynold298 opened 1 year ago

Reynold298 commented 1 year ago

https://learn.microsoft.com/en-us/troubleshoot/windows-server/deployment/enable-plug-play-for-parallel-port-devices

theliz12x commented 9 months ago

Hi, i've an iusse using an lpt port connected under Win11 via NET USE in the dosprompt. If i use the LPTX directly in the cmd prompt for example using the command type textfile > LPT3 it works. if i use the LPT3 as a textfile "inside" a dos application, the application get stuck and the print does not start

leecher1337 commented 8 months ago

You can try with dospr instead https://github.com/leecher1337/ntvdmx64/issues/161

emendelson commented 8 months ago

Is it OK to ask a question about dospr here? I'm trying to figure out how to print a file with ESC/P output to an HP LaserJet, and when I enter the command dospr -f epson.seq c:\path\to\file (with the current directory being the one with dospr and epson.seq) the result is that raw code gets printed to my default LaserJet. DOSPrinter.exe prints the expected output, but dospr doesn't. I downloaded from here:

https://www.waldbauer.com/tmp/dl.php?download=dospr

EDIT: I think I didn't take in that it's designed to work with GDI printers, and presumably that's what the problem is here...

leecher1337 commented 8 months ago

Hi Edward,

If the printer supports ESC/P, you can use the raw mode (-r ), but otherwise -f should work as expected. Maybe the data stream feeded to it contains escap-sequences not in epson.seq file..? To be able to check this, you can dump your input file here (or send it to me via e-mail) and I can try it with a PDF printer if I get a correct result. The only prerequisite for dospr is to have the printer working correctly in Windows, as it translates the output to a bitmap that is then spooled to the printer.

emendelson commented 8 months ago

Hi Ludwig,

I was experimenting to see if I could use dospr to interpret ESC/P data for non-ESC/P printers, for my various WordPerfect and other projects. My printers are all HP LaserJets, which don't have ESC/P support, and, as far as I can see, can't print bitmap data. So I'm probably wasting your time. But here's a small sample output file. DOSPrinter (shareware/commercial) prints it correctly on the LaserJet, so I assume that the data is accurate.

PRNSPL.zip

I don't suppose it's possible to add a switch that creates a PDF (maybe using GhostScript) from the bitmap? Or is that too far away from the scope of the project?

leecher1337 commented 8 months ago

Hello Edward,

I see [ESC 6] sequence, this sequence seems unknown from what I can see in this manual: https://download.brother.com/welcome/docp000579/cv_td4000_eng_escp_120.pdf

Found it in this implementation: https://github.com/joncampbell123/dosbox-x/blob/a933f3e6ccf461d58c0989167a66fc02d87670db/src/hardware/parport/printer.cpp#L872

Seems to be "printer upper command characters", from what I can see.

Other commands are indeed not supported, as only ESC/P sequences from printfil were implemented: https://www.printfil.com/download/epson.seq So very, very simplicistic implementation for the bare minimum. Here is a version that contains at least some "advanced" commands. Far from complete, but it can print your sample file: dospr.zip Contrary to other opensource projects, dospr drives the Windows GDI printer functions directly instead of using custom bitmap creation routines, so it's pretty fast and simple. Using it to produce PDF files shouldn't be a big deal, just specify a PDF printer driver with -p, i.e. PDFCreator, FreePDFxp or whatever you prefer.

emendelson commented 8 months ago

Hello again, and thank you. Obviously, this is progress, but I'm still getting random characters when I print to my LaserJet or any PDF driver:

abc.pdf

I doubt it's worth your time to fix this, as anyone who needs to print ESC/P files can use one of the commercial options.

leecher1337 commented 8 months ago

You need to specify the full path to epson.seq in -f command, i.e.:

dospr -f c:\temp\epson.seq -s c:\temp\prnspl

and you will get this: DOSprinter.pdf

emendelson commented 8 months ago
Of course! I forgot all about the .seq file. Apologies for wasting your time!