I am using a gsdll32.dll wrapper as described here http://stackoverflow.com/questions/16929383/simple-vb-net-wrapper-for-ghostscript-dll It works perfectly, except for tiffsep device. The device creates all the files ok, everything is ok for the separation files, except on the main composite preview file it leaves a handle open so the subsequent delete in my code fails on the file. Nevertheless, a subsequent call of gsdll with tiffsep with the same output file name from within the code works, but there is yet another handle left open on the main composite preview file. With another device, like tiff24nc, all works fine, the file produced by gsdll32.dll are not locked by any handle.
Created attachment 20589 [details] A sample program that uses GS API This demo program is the Example 1 from API.htm with some minor changes. Although it is not an original VB program, it demonstrates a similar problem: some of the separations are not closed. However, current version of Ghostscript does not close spot separations, rather than the composite file. The problem is caused by zeroing num_separations void free_separation_names( ){ // ... pseparation->num_separations = 0; } which is later used to calculate the number of available separations. Deletion of this line does not work, because this causes accumulation of separations with empty names.
Created attachment 20590 [details] One-page sample with spot colors.
Created attachment 20591 [details] Two-page sample with spot colors
In the initial report Alex has not specified the arguments being used, however assuming a single fixed filename (eg output.tif) this is expected behaviour. This is the way that Peter's example test harness is constructed. The reason is that the device doesn't close the file at the end of the page when there is a single file, it simply reuses it for the next page. The file is only closed when the device is closed. There are several ways to address this. Most simply is to use a format specifier such as "output%d.tif" for the filename. Alternatively you can open the device through PostScript and save/restore around the device selection. Deactivating the device with a restore will close the file. Finally you can use the (undocumented!) ReopenPerPage parameter. This will close the file after the end of the page. A subsequent page will open the file with the same name, but it will get a new file handle. Previously this would close the composite file, but not the separation files, which isn't really adequate. I have made a commit here: e9a5d8b623d489478a0091ad7ef9ef13c57cf1d6 which will also close the separation files at the end of the page if ReopenPerPage is true. I've also asked our documentation maintainer to update the documentation with this parameter. I'm closing this as fixed, because I've made a commit, though really it's more invalid or worksforme because the behaviourt is expected.