The-Wineskin-Project / WineskinServer

Wineskin
GNU Lesser General Public License v2.1
2.47k stars 170 forks source link

Printing in Sonoma #496

Open pere346 opened 11 months ago

pere346 commented 11 months ago

Environment (please complete the following information):

Describe the bug

After updating to Sonoma, it's not possible to print from any wrapper To Reproduce

File/print from any wrapper **Expected behavior** After updating to engine 23.6.0, printing should work on macOS Sonoma.

Additional context

Sonoma removed postscript support, but with 23.6.0, the release notes from CrossOver says: "23.6.0 CrossOver - October 18, 2023 macOS: Support for Counter-Strike 2 and Warframe. Printing now works on macOS Sonoma." I have tested with CrossOver and it is possible to print.
emendelson commented 11 months ago

Unfortunately, I can confirm this.

I wonder how CrossOver handles printing. The solution I use in my AppleScript apps is to use the open source ghostscript app to convert PostScript to PDF and then print the PDF. I have a universal build of gs that I'm happy to send if it's useful.

EDIT: I downloaded CrossOver, and, sure enough, it has an executable named ps2pdf_gs, which turns out to be an ancient (10 years old) Intel-only version of Ghostscript, built for a limited number of options. Any modern build of GhostScript should work equally well, but I haven't tried it.

Gcenx commented 11 months ago

@pere346 thank you for this bug, as per the comments from @emendelson this would indeed be a bug.


@emendelson

Unfortunately, I can confirm this.

Makes sense I've not needed to print from within wine for years.

I wonder how CrossOver handles printing. The solution I use in my AppleScript apps is to use the open source ghostscript app to convert PostScript to PDF and then print the PDF. I have a universal build of gs that I'm happy to send if it's useful.

Possibly attach as a stop gap?

I'll deal with building the same version of ghostscript as CodeWeavers so it's not over linked to things I don't ship and also so it won't try using brew etc.

EDIT: I downloaded CrossOver, and, sure enough, it has an executable named ps2pdf_gs, which turns out to be an ancient (10 years old) Intel-only version of Ghostscript, built for a limited number of options. Any modern build of GhostScript should work equally well, but I haven't tried it.

As usual they're using custom binary names for things....., as explained above think I'll simply provide the same version as CodeWeavers to avoid unforeseen problems.

emendelson commented 11 months ago

Here's that universal build of the latest gs:

https://www.dropbox.com/scl/fi/mp7rj9yxfhh6oxaizafm3/gs.zip?rlkey=b68o055zau890z4ci27ydssq2&dl=0

I tried to upload, but the limit is 25MB, and this is larger. I think I can build this to be a bit smaller, but this should do.

The one in CrossOver is Intel-only, but presumably that shouldn't be a problem.

EDIT: Just to clarify, Wine used to be able to print simply by sending PostScript output to macOS, which would print it. Those days are over, and Ghostscript is the only practical way to get this done. If you want the command that creates a PDF from PS, it's here:

gs -sBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile="path/to/output.pdf" "path/to/input.ps"

There are a lot of other options that are widely documented, but this gets the job done.

emendelson commented 11 months ago

For what it's worth: the current Crossover app uses domething called ps2pdf_gs, as I wrote earlier. But the open-source code in cups.c refers to cxps2pdf which is a script that runs Apple's old (now gone) ps2pdf but says it falls back to a Ghostscript script. Maybe it's possible simply to modify that script? Again, I'm just guessing and probably wasting your time.

One possible workaround: include in winetricks a Windows-based print-to-PDF driver so that users could print from a Windows app to a PDF file and then print that file from macOS. Not as convenient as printing, but maybe possible?

EDIT (again): I see now that Wine can't install Windows drivers like printer drivers - at least that's what the internet seems to say. So the only way to restore printing is to use CrossOver's method with gs, probably.

prog99 commented 9 months ago

Assume this is still not fixed? Noticed some extra debug in the logs but I think its already covered in some way or another above.

"cupsfilter: No filter to convert from application/postscript to application/pdf."

Gcenx commented 9 months ago

As I don't currently own a printer I can't test but heres an Engine that potentially might work https://github.com/Gcenx/WineskinServer/releases/download/V1.8.4.2/WS11WineCX64Bit23.7.1-printing_test.tar.7z

emendelson commented 9 months ago

Printing works when I create a new wrapper and run Notepad. I haven't been able to update a wrapper that uses WS11WineCX64Bit21.1.0 to the new engine - Wineskin always stops responding when I do. Is there some other way I can update that old engine?

EDIT: I remembered that the internal structure of 21.x is different from later releases, so I'll have to try to build a new wrapper for the app...

prog99 commented 9 months ago

Thanks for the new build. I'm still not seeing any prints hitting the cups queue whether I update an existing or build a new wrapper. Checked the wrappers and the postscript binaries are all there in SharedSupport/wine/bin

Gcenx commented 9 months ago

@emendelson if that’s a very old wrapper it’s lightly that the master wrapper itself is simply too old, you’d need to manually update the wrapper itself before being able to update the Engine.

Though even doing all that won’t guarantee it’ll work correctly.


@prog99 strange as @emendelson above said it’s working for them, as I’m using CodeWeavers solution if it’s not working there little I can do.

emendelson commented 9 months ago

I was wrong - I thought it printed yesterday, but it was probably a stray print job from something else. The new wrapper does NOT print today. Sorry to lead you astray!

EDIT: If you don't have a physical printer, you can use this instead:

https://github.com/rodyager/RWTS-PDFwriter

Gcenx commented 9 months ago

Well that sucks, hopefully that’s fake printer will be enough to get this working cleanly.

prog99 commented 9 months ago

You can also create a dummy printer in macOS. It'll obviously never work but you'll see the jobs hitting the queue. image

Gcenx commented 9 months ago

brew uninstall --zap wineskin brew install --cask --no-quarantine gcenx/wine/wineskin-devel

Then use WS11WineCX64Bit23.7.1 or WS11WineCX64Bit23.7.1_D3DMetal-v.1.1, I was able to get something added to print queue using the above Engines.

prog99 commented 9 months ago

Looks good and jobs have popped up on the queue. I also put 2.9.2.1-rc3 wrapper on at the same time and used WS11WineCX64Bit23.7.1_D3DMetal-v.1.1

sslupsky commented 8 months ago

Read through this issue and I am unable to generate a PDF. I have the following configuration:

wineskin-devel 1.8.4.3 
2.9.2.1-rc6 wrapper
WS11WineCX64Bit23.7.1_D3DMetal-v1.1 engine
Intel MP 6,1
Sonoma 14.3.1
PDFwriter 3.1
Ghostscript 10.02.1

I have reset the printing system. I have confirmed ps2pdf is installed:

lrwxr-xr-x  1 stevenslupsky  admin  40 27 Feb 15:36 /usr/local/bin/ps2pdf -> ../Cellar/ghostscript/10.02.1/bin/ps2pdf

When I run notepad and print, nothing appears in the macOS Print Center. If I look at the LastRunWine.log I see the following entry:

0024:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\spool\\drivers\\x64\\3\\wineps.drv" at 00000001ED2C0000: builtin
0024:trace:loaddll:free_modref Unloaded module L"C:\\windows\\system32\\spool\\drivers\\x64\\3\\wineps.drv" : builtin
0024:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\spool\\drivers\\x64\\3\\wineps.drv" at 00000001ED2C0000: builtin
0024:fixme:winspool:StartPagePrinter (0000000000000001): stub
0024:fixme:winspool:EndPagePrinter (0000000000000001): stub
cupsfilter: No filter to convert from application/postscript to application/pdf.

Screenshot 2024-02-28 at 12 12 01 PM

EDIT: I used the WS12WineCX64Bit23.7.1 engine and that generated a PDF. I was also successful sending the print job to a physical printer (HP Laserjet).

Gcenx commented 8 months ago

@sslupsky when using wineskin-devel your required to use the Engines it provides and not prior engines that’s why it didn’t work until you used a newer Engine.

Also as you’ve reported using an Intel Mac you can’t make use of D3DMetal anyway, you’ll notice that wineskin-devel the checkbox is disabled on your system.