joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.81k stars 383 forks source link

macOS no longer supports postscript files #4669

Open ezathashim opened 11 months ago

ezathashim commented 11 months ago

Is your feature request related to a problem? Please describe.

MacOS no longer supports Postscript files. The available settings in dosbox-x include:

printoutput: Output method for finished pages: png : Creates PNG images (default) ps : Creates PostScript bmp : Creates BMP images (very huge files, not recommended)

It would be good to have a PDF output instead of ps because of the limitations in modern macOS.

What you want

it would be good if printoutput had a 'pdf' output. I'm not an expert, but I imagine that the ps file would somehow get converted to the final PDF. Hopefully there is an open-source script that can be used to perform the conversion. Ghostscript might have something that can be used, but I'm not sure how to use it.

If PDF output is available, then it can be opened using 'Preview.app'.

Describe alternatives you've considered

Additional information

No response

Have you checked that no similar feature request(s) exist?

Code of Conduct & Contributing Guidelines

emendelson commented 11 months ago

@ezathashim The error message did not appear in your post. Could you try again?

And yes, please, could you ask an Engineer this question:

"Is there a terminal command that will tell me which of my printers are online? lpstat only tells me whether a printer is idle or active, not whether it's available for printing. Older versions of lpstat reported this information, but the current version does not."

ezathashim commented 11 months ago

You’re on a roll!

Sadly, if I print to LPT1, I get this error:

CleanShot 2023-12-24 at 07 20 51@2x

I don't think it is what you intended.

Can you detect this error case in code? If the error can be detected, maybe it should punt the output to Preview when the print job fails.

If you wish, I could always use one of my Apple Developer credits to ask an Apple Engineer on how to determine which printers are available on the network or connected to the computer using a terminal command. It would be best if you could formulate the question, though, since I’m not certain exactly what you need.

Thanks!

ezathashim commented 11 months ago

Ok, I sent a request to Apple Engineering. They're on vacation until January 2nd, so we'll get a reply early int he new year.

emendelson commented 11 months ago

@ezathashim - That error means that my script failed to complete because it was badly written. It works here, but something on your system is causing it to fail, and without hours of back-and-forth between the two of us, I'll never know exactly what. I've rewritten the print scripts. Please let me know what happens when you try them.

Also, in the future, when you report "if I print to LPT1" could you please tell me exactly what your default printer is, and where it is located - on a remote site, attached to your machine by a USB cable, on the local network on your system, etc. etc. I really can't fix anything without knowing exactly what the conditions are where things go wrong.

ezathashim commented 10 months ago

Ok, I tried the new version and get this again:

CleanShot 2023-12-25 at 02 23 08@2x

I only have network printers installed on my computer, and none of them are available at home.

emendelson commented 10 months ago

@ezathashim - What model printer are you trying to print to? Please give the full name and tell me if it is a laser or inkjet printer, exactly what its manufacturer and model number are. The macOS System Settings or System Preferences app will tell you what "Kind" of printer it is ("Generic PostScript Printer," "AirPrint Printer", etc., etc.). Please tell me what that is.

And have you tested with EVERY printer installed in your system, to see if some do not produce the error?

ezathashim commented 10 months ago

Ok, sorry, I did not realize you needed driver info. If I do this:

MBP-M1Max-16:dosbox-x-master ezat$ lpstat -p printer Brother_MFC_L2730DW_series3c2af47fefc2_ is idle. enabled since Tue 11 Oct 12:07:12 2022 printer Brother_MFC_L2730DW_series3c2af47fefc2__Fax is idle. enabled since Wed 21 Sep 17:30:39 2022 printer Brother_MFC_L2730DWseriesFax is idle. enabled since Wed 21 Sep 17:30:22 2022 printer HP_Color_LaserJet_Pro_M453_4 is idle. enabled since Fri 22 Dec 08:56:40 2023 printer HP_LaserJet_MFP_M227fdw_4065C2 is idle. enabled since Mon 21 Mar 14:01:16 2022 printer HP_OfficeJet_Pro_8720___Fax is idle. enabled since Tue 19 Apr 19:08:48 2022

The above gives me a list of installed printers on my computer. In the UI, I get this:

CleanShot 2023-12-25 at 08 20 43@2x

The default is:

MBP-M1Max-16:dosbox-x-master ezat$ lpstat -d system default destination: HP_Color_LaserJet_Pro_M453_4

I only use whatever driver each printer model downloads.

Hope this helps.

emendelson commented 10 months ago

@ezathashim - That helps. Thank you. I also have a Color LaserJet that is offline, but I don't get that error message:

HP_Color_LaserJet_Pro_M252dw__F6E983_

Next question: when you say you print, please tell me whether you are printing from a DOS PostScript driver or a DOS PCL driver or simply printing text.

emendelson commented 10 months ago

@ezathashim - one last thing. It's possible the printing scripts aren't executable.

Could you open a terminal, then type this into the terminal, followed by a space (the space is essential - and do NOT press Return):

cd

then drag the app into the terminal so its address is in the command line after the cd, and press Return.

Then enter:

cd Contents/Resources (and press Return)

Finally, enter:

chmod +x *.sh (and press Return).

Then open the app and try printing again.

ezathashim commented 10 months ago

I'm just using the dir>lpt1 command to print.

After doing all the Terminal instructions in your last comment, it seems to be the same result:

CleanShot 2023-12-25 at 09 00 07@2x

emendelson commented 10 months ago

@ezathashim - One more thought: with my current code, enter this command in the terminal in the folder with the build scripts:

make distclean

Then delete or move all copies of the dosbox-x-etc. app that may be in the folder.

Then build again with ./build-macos-app and try printing one more time.

If that doesn't work, then I'm completely baffled, unfortunately. But please let me know whether it prints when you are in the office.

ezathashim commented 10 months ago

Ok, some movement. After doing the 'make distclean', the first time I try 'dir>lpt1', I get this:

CleanShot 2023-12-25 at 10 24 17@2x

and then, after pressing 'Allow', I get this:

CleanShot 2023-12-25 at 10 24 29@2x

The next time I ran the print job, it took 30 seconds for the alert to show up, so perhaps you should shave it down somewhat, maybe to 5-10 seconds.

Great!

I think if Apple Engineering gives a good reply concerning available printers, this whole part will work better.

Also, I wonder if sending the job directly to a printer is worth it or not. Maybe it's better just to open Preview and then the user can decide whether to print it or not. Sometimes the DOS print job has a poor layout, and it is useful to review it before putting it on paper.

emendelson commented 10 months ago

@ezathashim - Thank you. That is exactly what is supposed to happen. You won't be asked to "allow" again; the first time is enough - unless you rebuild the program, when you might be asked the first time you run it.

I needed 30 seconds on my system to avoid false positives. You can try reducing the number by editing textprint.sh inside the app and changing the line for ((n=0;n<30;n++)); do

And to preview before printing, simply print to lpt2 instead of lpt1. Or, if you prefer to print to lpt1, edit doxbox-x.conf inside the app.

emendelson commented 10 months ago

@ezathashim - The latest code offers to write a PDF to the desktop if the printer is unavailable. This was an excellent idea. Thank you again.

ezathashim commented 10 months ago

Nice! Many thanks for your hard work.

On Dec 26, 2023, at 7:00 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - The latest code offers to write a PDF to the desktop if the printer is unavailable. This was an excellent idea. Thank you again.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1869829346, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U54BCHDHD4AMMKGCUVTYLNQJRAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRZHAZDSMZUGY. You are receiving this because you were mentioned.

ezathashim commented 10 months ago

I have a slightly different question, but maybe it is related to this current work.

My DOS app is a very simple accounting program. To get it turn run, I have to configure DOSBox with 'A20 = off'. If I do not do this, DOSBox is unable to open the file archives for the DOS app.

The issue I am having is that the screen refresh is extremely slow. Here is a video with me moving the cursor up and down:

CleanShot 2023-12-27 at 10 11 52

Would you know what there is such an unbearable lag? The lag is also present when trying to input text, rendering it very difficult to use. Previous versions of DOSBox did not have this.

Any ideas?

emendelson commented 10 months ago

@ezathashim - Please open a separate issue so that people who know the answer (I don't) can see it and reply. This has nothing to do with the subject of the current thread.

ezathashim commented 10 months ago

I received a response from Apple Engineering with regards to finding available printers:

AppleEngineer Response to Finding Available Printers.txt

I have no knowledge if you can wrap Core macOS API into a script.

It seems that there might be a bug when using existing Terminal commands. If you file a bug report, forward the bug report ID to me so that I can send it back to the Apple Engineer, who will then prioritize it internally.

emendelson commented 10 months ago

@ezathashim - Thank you for asking this. Probably a programmer with minimal skills could do something with this, but I can't, unfortunately. Will try to get a bug report written in the next few days.

emendelson commented 10 months ago

@ezathashim - I think I solved the problem of detecting when a printer is offline; it's not as fast as I would like, but at least you get warned before you print, not afterwards. Try building the current code.

EDIT: No, wait, I have to fix one detail.

EDIT: I think it may be right now. Use the build-macos-app-print script for testing if you're interested.

ezathashim commented 9 months ago

Sorry, I was caught up with work.

I downloaded the latest version from you repo and tested these:

dir>lpt1

This worked perfectly, and seemed very timely in presenting the ’No Available Printers’ alert.

dir>lpt2

This no longer works for some reason. It does not open Preview. Does it work for you?

dir>lpt3

This worked perfectly and saves the PDF to the desktop.

On Jan 9, 2024, at 9:47 PM, emendelson @.***> wrote:

@ezathashim https://github.com/ezathashim - I think I solved the problem of detecting when a printer is offline; it's not as fast as I would like, but at least you get warned before you print, not afterwards. Try building the current code.

— Reply to this email directly, view it on GitHub https://github.com/joncampbell123/dosbox-x/issues/4669#issuecomment-1884105586, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABI7U5ZWDFOKYNNEP4K5BGTYNX6NTAVCNFSM6AAAAABAQKW7UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGEYDKNJYGY. You are receiving this because you were mentioned.

emendelson commented 9 months ago

@ezathashim -

Thank you for testing. I've changed the LPT assignments to match the ones my DOSBox-X-App, which wraps DOSBox-X in an AppleScript wrapper and has other customizations.

LPT2 now tries to print "raw" printer data to the default printer.

LPT4 now creates a temporary file and opens Preview.

You can change these by editing the conf file, and I may change my DOSBox-X-App to match my original assignments here (LPT2 opens View), because I doubt many people care about sending raw print data.

emendelson commented 9 months ago

@ezathashim - I restored the original LPT2/LPT4 assignments, and changed my DOSBox-X-App to match. It makes more sense to use LPT2 for something that most users will want (view-document).