Adding custom paper sizes to winspool.drv

Questions about Wine on Linux
Locked
User avatar
superscript
Newbie
Newbie
Posts: 4
Joined: Wed Mar 09, 2016 11:46 pm

Adding custom paper sizes to winspool.drv

Post by superscript »

Hey all, I've moved all my software from WinXP to Linux/Wine and I'm setting things up. I'm need now to be able to do printing to Cups-PDF to more paper sizes than those which are offered by Wine, specifically the Arch E1-30"x42" size.

It appears that this list is defined in winspool.drv. I first tried editing `~/.wine/drive_c/windows/system32/winspool.drv`, but that had no effect. I then used winecfg to set that library as native rather than builtin (ignoring the recommendation popup) and found myself with a disfunctional wine prefix (fixed by removing that override in the registry).

Well now I realize that there is a winspool.drv.so listed in Wine's /usr/lib/wine folder with those sizes defined in it. So it appears to me that set of paper sizes is hard-coded into Wine.

So, what's my best bet for adding some options for printing? Will I need to compile Wine from source or is there some built in way that I'm just missing?

I am doing the printing from Microsoft Excel and AutoCAD 2000 in Wine-1.9.5 to the Cups-PDF system on Arch Linux.

Does anyone have an idea what would be the best way for me to add a few paper sizes to Wine?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Adding custom paper sizes to winspool.drv

Post by dimesio »

When I open a spreadsheet in Excel 2007 and select CUPS-PDF as a printer, I am able to set the paper size to Arch E, and it does create a pdf in that size (36"x48"). It's true there is no "Arch E1" on the list, but there isn't one when I do it from Libre Office or Gimp, either, so that seems to be a limitation of CUPS-PDF, not Wine.
User avatar
superscript
Newbie
Newbie
Posts: 4
Joined: Wed Mar 09, 2016 11:46 pm

Re: Adding custom paper sizes to winspool.drv

Post by superscript »

I'm using Excel 2000 and AutoCAD 2000.

I've attached a screenshot of the printer custom properties dialog box I come to in both programs. It has the following paper sizes:
Letter, Legal, Executive, A3, A4, A5, B5 (JIS), Envelope B5, Envelope #10, Envelope C5, Envelope DL, Envelope Monarch
I get there by clicking "Properties..." next to the printer in Excel's print dialog.

What makes me believe that this belongs to Wine is that that same list occurs (in the same order) between line 488 and line 499 of /usr/lib/winspool.drv.so

In contrast, this is the list of paper sizes supplied by Cups-PDF as found under Set Default Printer Options on the localhost:631 configuration page:
Custom, 11x14, 11x17, 13x19, 16x20, 16x24, 2A, 4A, 8x10, 8x12, A0, A1, A2, A3, A4, A5, ANSI A, ANSI B, ANSI C, ANSI D, ANSI E, Arch A, Arch B, Arch C, Arch D, Arch E, C0, C1, C2, C3, C4, C5, Envelope #10, Envelope C5, Envelope DL, Envelope Monarch, Executive, B0 (ISO), B1 (ISO), B2 (ISO), B3 (ISO), B4 (ISO), B5 (ISO), B0 (JIS), B1 (JIS), B2 (JIS), B3 (JIS), B4 (JIS), B5 (JIS), Ledger, US Legal, US Letter, RA0, RA1, RA2, RA3, RA4, SRA0, SRA1, SRA2, SRA3, SRA4, Super A, Super B, Tabloid Extra, Tabloid

I'm not sure why Excel 2007 is allowing you to print to more sizes; I find this same limitation in every program I've tried: Excel 2000, Word 2000, AutoCAD 2000, Acrobat CS2, Wine Notepad. I suspect that Excel 2007 is built with custom printing capabilities allowing it more options than are available to older software.

@dimesio could you try printing from Wine's Notepad to see what paper size options it gives you?

If that list of twelve options turns out able to be added to nicely in the Wine source, would a patch to increase it to the lengthy list I find from the Cups-PDF configuration be a welcome addition to Wine's codebase? I'm a little reluctant to go get into the source code if my work there would have me applying a custom patch every version release.
Attachments
Screenshot of the wine printer dialog.
Screenshot of the wine printer dialog.
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Adding custom paper sizes to winspool.drv

Post by dimesio »

Wine's notepad gives me the same list of paper sizes as Excel does when I select cups-pdf as the printer, and that includes everything that's listed in cups-pdf.ppd, except for "Custom." If you're not seeing that, something is wrong on your system.
User avatar
superscript
Newbie
Newbie
Posts: 4
Joined: Wed Mar 09, 2016 11:46 pm

Re: Adding custom paper sizes to winspool.drv

Post by superscript »

Okay, that's good to know; I've just tested `wine notepad`, `Ctrl-P`, `Properties` in a new 32-bit wine prefix and my system doesn't give me any more than the page size list I posted above, so my setup's definitely got a problem.

I've checked and my "/etc/cups/ppd/PDF Printer.ppd" has 65 different sizes defined in it, only a few of which I can see from Wine.

What is your recommendation on how to start debugging this?

By the way, is there a way for me to edit this thread's title to reflect where this problem is at?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Adding custom paper sizes to winspool.drv

Post by dimesio »

I was just comparing your screenshot of the printer dialog to mine. Yours says (for "PDF Printer"):
Where: LPR:PDF_Printer
Comment: WINEPS Printer using LPR
whereas mine says (for "CUPS-PDF"):
Where: CUPS:CUPS-PDF
Comment: CUPS-PDF
Your "PDF Printer" isn't CUPS-PDF, it's Wine's Generic Postscript Printer. That's why you are only seeing the paper sizes from the generic postscript printer ppd file that is part of winspool.drv.so.

Well, I have to ask the obvious question: what other printers are available on your system? Are you sure you didn't simply select the wrong driver?

If it's not that simple (it probably isn't), then you need to figure out why "PDF Printer" is pointing to Wine's generic driver rather than CUPS-PDF. If you manually changed any settings in Wine or CUPS to try to get printing to work, that could be the issue. It could also be a problem with your Wine build. If you're using a distro Wine package, you may want to contact the package maintainer. If you built Wine yourself, take a look at the config.log and make sure you didn't overlook any messages about missing dependencies (esp. ones mentioning CUPS). All I can tell you from this end is that I didn't do anything special to get Wine to recognize CUPS-PDF. It should just work.
User avatar
superscript
Newbie
Newbie
Posts: 4
Joined: Wed Mar 09, 2016 11:46 pm

Re: Adding custom paper sizes to winspool.drv

Post by superscript »

In https://wiki.winehq.org/Wine_User%27s_Guide, it says "If you do not use CUPS, the old BSD-Printing system is used:" and continues to talk about LPR and such.

So I believe I'm using that "old BSD-style printing" instead of getting a direct connection between Wine and Cups. And that's what I'm working on figuring out...

Do you have anything under HKCU\Software\Wine\Printing? I don't have that key in my Wine registry, but that might not be related.

Also, what distro are you running that set things up automatically? I'm just running the build from Arch; do you know how to tell if it has cups support baked in?
User avatar
dimesio
Moderator
Moderator
Posts: 13367
Joined: Tue Mar 25, 2008 10:30 pm

Re: Adding custom paper sizes to winspool.drv

Post by dimesio »

superscript wrote: Do you have anything under HKCU\Software\Wine\Printing? I don't have that key in my Wine registry, but that might not be related.
I don't have that key either.
Also, what distro are you running that set things up automatically? I'm just running the build from Arch; do you know how to tell if it has cups support baked in?
I'm on openSUSE, but CUPS support should work out of the box on any distro that builds Wine with CUPS support (AFAIK, they all do) provided the user has all the necessary CUPS libs installed on their system.

Info on the Arch Wine package is here: https://www.archlinux.org/packages/mult ... 6_64/wine/. CUPS is listed as an optional dependency, which suggests the package was compiled with CUPS support, but do you have all the necessary CUPS libs installed on your system? What's most likely to be missing are the 32 bit libs.
Locked