node-native-printer
node-native-printer copied to clipboard
Image locks not released
Hello,
Many thanks for this lib, it worked out very well for me. However, there seems to be an issue : ]
Describe the bug I think there is a problem with how images are accessed.
To Reproduce Print an image, then go and try to delete it. It will not work, the file is EBUSY, locked by the node process.
Expected behavior I believe that the code places a lock on the file (https://github.com/MatteoMeil/node-native-printer/blob/master/lib/windows/src/windows_printer/Methods.cs#L267) and does not release it, even though the reference is good for garbage collection.
OS Windows 10
I haven't had a chance to try much else, only images on Windows 10.
@juona I had the same issue, I forked this repo, made the necessary modifications to unlock the files and built a new dll for this, just finished testing on windows 10 and it works (I'm not a C# programmer so excuse the commits where I was attempting different solutions):
https://github.com/bennettstone/node-native-printer / https://github.com/bennettstone/node-native-printer/commit/d83959bb9815824bc280a58ee8dce970c22e6afc
I included it in my electronjs project by running:
npm install --save bennettstone/node-native-printer#d83959bb9815824bc280a58ee8dce970c22e6afc
npm install --save bennettstone/node-native-printer#d83959bb9815824bc280a58ee8dce970c22e6afc
This solution works for me. Thanks a lot!!!
@bennettstone It took me a while to come back to this. I can confirm that this does indeed work. I'd recommend raising a PR, however this lib does not seem to be actively maintained.
Thanks for your help!