Virtual printer

Here you can discuss the development of patches

Re: Virtual printer

Postby canadacow » 2004-2-17 @ 18:44

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-2-17 @ 19:17, edited 1 time in total.
User avatar
canadacow
Member
 
Posts: 466
Joined: 2003-5-11 @ 23:00
Location: United States

Virtual printer bug report

Postby mirekluza » 2004-2-17 @ 19:04

I think that it should be possible to print by copying to devices PRN, LPT1:
copy x.txt prn
copy x.txt lpt1

In DOSBOX the first command creates file, the second freezes the DOSBOX.

Mirek
mirekluza
DOSBox Moderator
 
Posts: 1697
Joined: 2003-8-21 @ 04:19

Re: Virtual printer

Postby Fizzban » 2004-2-17 @ 19:29

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.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby Fizzban » 2004-2-17 @ 23:49

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.
You do not have the required permissions to view the files attached to this post.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby jal » 2004-2-19 @ 14:47

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 viewtopic.php?t=3733, which would be direct forwarding.


JAL
User avatar
jal
Member
 
Posts: 488
Joined: 2004-1-02 @ 15:30
Location: Amersfoort, Netherlands

Re: Virtual printer

Postby Fizzban » 2004-2-24 @ 16:15

Due to popular demand (well, two people :lol: ), 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.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby canadacow » 2004-2-26 @ 02:21

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!
User avatar
canadacow
Member
 
Posts: 466
Joined: 2003-5-11 @ 23:00
Location: United States

Re: Virtual printer

Postby Tekmaven » 2004-2-27 @ 13:46

Can someone compile DOSBox with this included for Win32? I'm having some issues...
Tekmaven
Newbie
 
Posts: 8
Joined: 2004-2-27 @ 05:21

Re: Virtual printer

Postby Fizzban » 2004-2-28 @ 01:34

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..
You do not have the required permissions to view the files attached to this post.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby Tekmaven » 2004-2-28 @ 01:39

I'm pretty sure I just got it all figured out with VC7.1 (.NET), so lemme give my compile a try, and if all else fails, I'll try yours.

Thanks for the help; the font location was my next question ;-).
Tekmaven
Newbie
 
Posts: 8
Joined: 2004-2-27 @ 05:21

Re: Virtual printer

Postby Tekmaven » 2004-2-28 @ 05:03

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?

This mod is really going to save me :-). Do you know if its going to be in the next release?
Tekmaven
Newbie
 
Posts: 8
Joined: 2004-2-27 @ 05:21

Re: Virtual printer

Postby Fizzban » 2004-2-28 @ 14:16

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.. :happyhappy: 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.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby Tekmaven » 2004-2-28 @ 20:32

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..


That's what I did :-P. When I run dosbox.exe, it yells at me, saying I'm missing cygpng12.dll.
Tekmaven
Newbie
 
Posts: 8
Joined: 2004-2-27 @ 05:21

Re: Virtual printer

Postby Fizzban » 2004-2-28 @ 23:28

Strange.. Well, here is the file..
You do not have the required permissions to view the files attached to this post.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby Helmut Jarausch » 2004-3-01 @ 10:13

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
Helmut Jarausch
Newbie
 
Posts: 2
Joined: 2004-2-24 @ 10:18

Re: Virtual printer

Postby Qbix » 2004-3-01 @ 12:09

hmm I notice
well
stricmp shouldn't be used.
always the unix variant and include cross.h to cope with the differences
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 9694
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: Virtual printer

Postby Fizzban » 2004-3-01 @ 12:30

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.
User avatar
Fizzban
Newbie
 
Posts: 75
Joined: 2003-12-15 @ 10:36

Re: Virtual printer

Postby Tronic » 2004-6-03 @ 21:16

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)?
Tronic
Newbie
 
Posts: 4
Joined: 2003-8-19 @ 17:33

Re: Virtual printer

Postby ChaosFish » 2004-6-04 @ 12:29

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.
User avatar
ChaosFish
Member
 
Posts: 409
Joined: 2003-9-05 @ 18:38
Location: Israel

Re: Virtual printer

Postby Tronic » 2004-6-04 @ 12:46

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.
Tronic
Newbie
 
Posts: 4
Joined: 2003-8-19 @ 17:33

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: SA1988 and 0 guests