Summary: | tiffsep leaves handle open on main generated composite file when called from within code in .net | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Alex <alexandrucirip> |
Component: | Client API | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | alexandrucirip, ghostpdl-bugs, sphinx.pinastri |
Priority: | P4 | ||
Version: | 9.10 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Customer: | Word Size: | --- | |
Attachments: |
A sample program that uses GS API
One-page sample with spot colors. Two-page sample with spot colors |
Description
Alex
2013-12-20 05:03:23 UTC
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. |