VOGONS

Common searches


Virtual printer

Topic actions

  • This topic is locked. You cannot reply or edit posts.

Reply 20 of 150, by canadacow

User metadata
Rank Member
Rank
Member

I would suggest dropping both PNG support and Win32 support and have DosBox output PostScript instead. This would maintain compatibility as such files could be directly piped to postscript printers, converted to PDF on the fly using Acrobat Distiller, or viewed and printed using GhostScript.
Anyway, take my suggestion with a grain of salt... I certainly don't want to sound demanding. This is actually really cool. Nice work!

Last edited by canadacow on 2004-02-17, 19:17. Edited 1 time in total.

Reply 22 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie
canadacow wrote:

I would suggest dropping both PNG support and Win32 support and have DosBox output PostScript instead. This would maintain compatibility as such files could be directly piped to postscript printers, converted to PDF on the fly using Acrobat Distiller, or viewed and printed using GhostScript.

Adding support for PS would surely be nice but do you know a GPL library that can create a PS file given a bitmap? I did a little search and only found a PNG-to-EPS-converter (bmeps).

Also, I think keeping PNG support is a good idea because the LIBPNG is already included in DOSBOX to create screenshots (so we do not gain anything by removing the support) and the compression of PNG is significantly better than the one of Postscript.

mirekluza wrote:

I think that it should be possible to print by copying to devices PRN, LPT1

My guess is that DOSBOX does not support copying content to devices yet. This is not really related to the implementation of the LPT1 and PRN devices.

Reply 23 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie

I cleaned up the code, fixed a few bugs and implemented the outstanding ESC/P commands.

The printer should now be ready to be included in the CVS, so submitted a patch.

Attached are the fonts required by the printer.

Attachments

  • Filename
    fonts.zip
    File size
    494.38 KiB
    Downloads
    489 downloads
    File comment
    Fonts required by printer
    File license
    Fair use/fair dealing exception

Reply 24 of 150, by jal

User metadata
Rank Oldbie
Rank
Oldbie
Qbix wrote:

adding printing directly to the printer will give a lot headaches. (especially if the result isn't what they expect)

True, but any emulation gives headaches, see this forum 😀.

Qbix wrote:

Dosbox is for me still an emulator. With as little contact with host hardware at all.
The only exception to this is midi.
But offcourse feel free to have your own opinion about it.

I don't agree. DOSbox emulates all kinds of devices, and many of these are rerouted to the corresponding device, e.g. screen and CD-ROM. I don't see why the printer would be any different. Making output written to an LPT port intended for a dot-matrix printer appear on a Windows laser printer sounds like emulating to me! It would be a different thing altogether taking the approach ment in Can DOSBox allow a computer's soundcard to play sound & music?, which would be direct forwarding.

JAL

Reply 25 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie

Due to popular demand (well, two people 🤣 ), I have added support for outputting the virtual pages as Postscript files. As candacow pointed out, these file can be easily viewed, printed and converted to PDF using Ghostview (or similar tools). This way, the output is rather OS-independent.

Because Postscript files may contain more than one page, I also added support for multi-page printing. When enabled, the virtual printer will just append created pages to one PS file until DOSBOX is closed or the user presses ALT-F8. This also works with print jobs when using direct printing under Win32.

The updated patch is available here. I created the PS support from scratch, so no additional external dependencies are introduced by this feature.

Reply 26 of 150, by canadacow

User metadata
Rank Member
Rank
Member

The updated patch is available here. I created the PS support from scratch, so no additional external dependencies are introduced by this feature.

Very impressive! I just tried this out with First Choice and it works great. Again, great job!

Reply 28 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie
Tekmaven wrote:

Can someone compile DOSBox with this included for Win32? I'm having some issues...

Here you go. You also need the fonts I posted above and put them into the DOSBOX directory.

Hopefully the virtual printer will get into the CVS (and rjpa's compilations) soon so more people can check out this feature and give feedback..

Attachments

  • Filename
    dosbox.printer.zip
    File size
    493.36 KiB
    Downloads
    543 downloads
    File comment
    Compiled Win32 version
    File license
    Fair use/fair dealing exception

Reply 31 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie
Tekmaven wrote:

For some reason, I'm missing some DLL files. If its not too much trouble, could you ZIP up your whole DOSBox dir so I get all the DLLs?

Well, that IS my DOSBOX dir.. 😁 Just install DOSBOX 0.61. That will give you all the DLLs you need. The printer doesn't require extra dynamic libraries..

Tekmaven wrote:

This mod is really going to save me 😀. Do you know if its going to be in the next release?

No.. haven't heart back from the developers about that.

Reply 34 of 150, by Helmut Jarausch

User metadata
Rank Newbie
Rank
Newbie

OK,
here is the first plea for printing under Linux.

How does the current implementation work?
I had to patch printer.h to make it compile under Linux, but what does it
really do? Where to put the "fonts" file?

Is it so hard to just copy output going to PRN: or LPT1: to a file?
What to start to look at if one wants to implement that?

Here the tiny patch to printer.h
diff -r -u -N dosbox_prt_old/include/printer.h dosbox_prt_new/include/printer.h
--- dosbox_prt_old/include/printer.h 2004-02-24 16:10:32.000000000 +0100
+++ dosbox_prt_new/include/printer.h 2004-03-01 10:41:56.000000000 +0100
@@ -32,6 +32,12 @@
#include <windows.h>
#include <winspool.h>
#endif
+#if defined (LINUX)
+#include <strings.h>
+#define stricmp strcasecmp
+#define itoa(num,buf,len) sprintf(buf,"%*d",len,num)
+#endif
+

#define STYLE_PROP 0x01
#define STYLE_CONDENSED 0x02

Helmut Jarausch
RWTH-Aachen University
Germany

Reply 36 of 150, by Fizzban

User metadata
Rank Newbie
Rank
Newbie

Except of these little incompabilities, printing under LINUX shouldn't be a problem. Just put the fonts into your DOSBOX directory, select postscript as output method in dosbox.conf, print in your DOS program, then print the created .ps file using Ghostscript or a similar tool.

Reply 37 of 150, by Tronic

User metadata
Rank Newbie
Rank
Newbie

Very interesting 😀

I didn't test it yet, but I'd certainly have use for ASCII/CP437 text printing...

The PRN and LPT1 problems look like the dos implementation of DOSBOX didn't recognize those and forward the printing works to actual printers. Instead, it calls the host OS to create a file with that name (and this will do bad things on WIN32). Maybe you got those problems fixed already (as I said, didn't test yet).

Additionally, could you make it automatically call ghostscript to actually print each page, as soon as it is done (maybe pipe it directly to ghostscript and not save to file at all)?

Reply 38 of 150, by ChaosFish

User metadata
Rank Member
Rank
Member
Qbix wrote:

hmmm not sure if it's a good idea to allow to host printing at all.
I think sticking to png in all cases is more approate.

I agree, PNG would be the best solution. One of the advantages of DOSBox is that is a closed secured "box". If it would access the printer, it will be open to printer viruses.

Reply 39 of 150, by Tronic

User metadata
Rank Newbie
Rank
Newbie

How exactly is printer any different from other hardware access DOSBox has to do?

DOSBox can play very loud hf square wave out of your stereo, killing the speakers. It can also stuff your HDD with garbage (useless files). Additionally, it apparently can create files with names that are forbidden on the host system (CON, AUX, PRN, LPTx, COMx, CLOCK$, LST, NUL). Possibly this could even crash W98 & friends with the CON\CON trick.

Naturally the printer support would be optional and not print anything unless you configure which printer to use in dosbox.conf.