rodyager / RWTS-PDFwriter

An OSX print to pdf-file printer driver
GNU General Public License v2.0
836 stars 79 forks source link

Utility crashes when creating destination folder on system that had Lisanet PDFWriter installed earlier #25

Closed emendelson closed 1 year ago

emendelson commented 1 year ago

This project is exactly what I've been hoping for, but I can't create the destination folder under macOS 13.1 on an M1 machine. The utility shuts down unexpectedly when I try to select a location for the folder, and the folder doesn't get created. I tried creating the folder in ~/Documents by hand but the printer wouldn't print anything to it. Is this a known problem? Is there any way to set it up manually?

Here's a crash report, if it helps...

DestinationReport.txt

EDIT: It installs correctly on another 13.1 setup that I have on the same disk. My guess is that the problem is that I tried to install the old Lisanet PDFwriter on the same system earlier. I tried to fix it by running the uninstall script and moving to the trash everything that Find Any File showed me had the name PDFWriter in it (except for your installer), but that didn't work.

EDIT 2: I got it working by restarting after removing every trace of anything named PDFWriter, then installing the printer, then using sudo to create the folder /private/var/spool/pdfwriter/<MyUserName>, then using sudo to create a shortcut pointing to that folder, and inside the same folder, named PDFWriter Files; and then copying that shortcut to ~/Documents and renaming the copy PDFWriter. Does this sound like the right procedure? I can't imagine why this didn't work when I ran the installer, but I hope it may help sort it out for the next user who may encounter the same problem.

As I said, the installer worked perfectly on a Ventura system that did NOT have the old PDFWriter installed, and only failed on a system where I had installed and removed the old PDFWriter.

And thank you for this elegant solution.

EDIT 3: I also had to use sudo chmod -R a+rwx /private/var/spool/pdfwriter/<myusername> so that I could manage output files. Presumably the installer does this for me when it works correctly?

rodyager commented 1 year ago

Thanks for this. There was enough information here to reproduce the crash even on an Intel machine. The problem arises because the Utility is attempting to create an alias to a folder that doesn't exist yet. The folders /private/var/spool/pdfwriter and /private/var/spool/pdfwriter/ are created by the printer driver when you print if they don't already exist.

The easy work around until I fix it is to "Print" a document using the pdfwriter printer driver first, and then open the Utility to create your Destination folder. [The document you printed will be available there].

emendelson commented 1 year ago

I'm glad to be able to help. As I said, I do have it working here after those manual fixes but of course I would prefer to have my system set up the "official way." Could you possibly let me know if there's anything I should do (chown? chmod?) to make my setup match the official one?

I was grateful to have your driver because I needed to test the printing in an AppleScript app that I'm working on, and I'm on the road with no physical printer. Your driver let me do all the testing I needed.

EDIT: I don't pretend to know what I'm doing, but I wonder if a simple lpr command in your installation procedure could print a "Welcome to PDFwriter" before offering the user to create the Destination folder?

rodyager commented 1 year ago

To get the “official way” from where you are:

  1. move any pdfwriter printed documents you want to keep to a new location.

  2. sudo rm -r /var/spool/pdfwriter - this will remove everything that you did.

  3. Print something using the PDFwriter printer driver. This will recreate /var/spool/pdfwriter/ and /var/spool/pdfwriter/emendelson/ with correct permissions and the Icon for the inner folder.

  4. Open the utility (open the Printer, click on the settings gear, choose Utility and click the button) and create your destination so you can easily access the printed documents.

I hope that makes sense. Step 3 is the key to avoiding the crash in Step 4.

Rod

On 14 Jan 2023, at 7:48 am, emendelson @.***> wrote:

I'm glad to be able to help. As I said, I do have it working here after those manual fixes but of course I would prefer to have my system set up the "official way." Could you possibly let me know if there's anything I should do (chown? chmod?) to make my setup match the official one?

I was grateful to have your driver because I needed to test the printing in an AppleScript app that I'm working on, and I'm on the road with no physical printer. Your driver let me do all the testing I needed.

— Reply to this email directly, view it on GitHubhttps://github.com/rodyager/RWTS-PDFwriter/issues/25#issuecomment-1382370485, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKSADNCLFXVUGJHIQ6IIYTWSG5S3ANCNFSM6AAAAAAT2RFF3Q. You are receiving this because you commented.Message ID: @.***>

kbernhagen commented 1 year ago

Wouldn’t it be better to just create a symlink instead of a macOS alias?

rodyager commented 1 year ago

What a great idea.

I hadn’t thought about FileManager().createSymbolicLink(at: withDestinationURL: ) and it has the great advantage that it doesn’t care whether the DestinationURL exists yet.

I’ll push a new version shortly.

Rod

On 14 Jan 2023, at 11:12 am, Kevin Bernhagen @.***> wrote:

Wouldn’t it be better to just create a symlink instead of a macOS alias?

— Reply to this email directly, view it on GitHubhttps://github.com/rodyager/RWTS-PDFwriter/issues/25#issuecomment-1382599103, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKSADPJW5NMVJMVRKKDMMLWSHVNJANCNFSM6AAAAAAT2RFF3Q. You are receiving this because you commented.Message ID: @.***>

emendelson commented 1 year ago

To get the “official way” from where you are: 1. move any pdfwriter printed documents you want to keep to a new location. 2. sudo rm -r /var/spool/pdfwriter - this will remove everything that you did. 3. Print something using the PDFwriter printer driver. This will recreate /var/spool/pdfwriter/ and /var/spool/pdfwriter/emendelson/ with correct permissions and the Icon for the inner folder. 4. Open the utility (open the Printer, click on the settings gear, choose Utility and click the button) and create your destination so you can easily access the printed documents. I hope that makes sense. Step 3 is the key to avoiding the crash in Step 4. Rod

That was exactly what was needed. Thank you!

rodyager commented 1 year ago

This is now fixed in the latest release. Thanks

emendelson commented 1 year ago

Just a quick FYI: I ran the new installer without removing the old version, and it crashed at the point where it said that the destination already existed, and did I want to replace it, and I answered Yes. No harm done, but maybe worth looking into?

rodyager commented 1 year ago

Yes. I encountered that myself. I should fix it.

Rod

Sent from my iPhone

On 15 Jan 2023, at 12:49 am, emendelson @.***> wrote:



Just a quick FYI: I ran the new installer without removing the old version, and it crashed at the point where it said that the destination already existed, and did I want to replace it, and I answered Yes. No harm done, but maybe worth looking into?

— Reply to this email directly, view it on GitHubhttps://github.com/rodyager/RWTS-PDFwriter/issues/25#issuecomment-1382743731, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKSADM2YKTAAWOA4CXWMQLWSKVD5ANCNFSM6AAAAAAT2RFF3Q. You are receiving this because you modified the open/close state.Message ID: @.***>

rodyager commented 1 year ago

And it is fixed now (and the v.2.0.1 installer has been updated to also include this fix).

emendelson commented 1 year ago

Fixed. Thank you.

kbernhagen commented 1 year ago

I think there should be a version bump even if you are only updating the installer.

kbernhagen commented 1 year ago

I found this very useful: https://keepachangelog.com/

And, of course: https://semver.org/

rodyager commented 1 year ago

Done.

Rod

On 15 Jan 2023, at 1:53 pm, Kevin Bernhagen @.***> wrote:

I found this very useful: https://keepachangelog.com/

— Reply to this email directly, view it on GitHubhttps://github.com/rodyager/RWTS-PDFwriter/issues/25#issuecomment-1383037723, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKSADK2LH3JOHZSALIXVX3WSNRBDANCNFSM6AAAAAAT2RFF3Q. You are receiving this because you modified the open/close state.Message ID: @.***>