Copy link to clipboard
Copied
I have the following snippet. Assume "thePrinter" sets the print preset name. If my client opens the doc and prints it using these options, then close it without saving changes, it prints OK, but when they go to reopen the file, they get an alert saying "The file *name* is an unsupported format and can't be opened. If I run the same snippet, but without printing, it works fine. So the issue is either in the print preset, or with how their file system is treating files. Does anyone have any thoughts? Thanks in advance.
if (i == thePrinterNum) {
var thePrinter = getPrinter();
pOptions.printPreset = thePrinter;
pOptions.jobOptions = jbOptions;
}
doc = app.open(File(pathStr + theImage), DocumentColorSpace.RGB);
jbOptions.file = doc.fullName;
userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
for (var c = 0; c < numPrints; c++) {
doc.print(pOptions);
}
userInteractionLevel = storeUserInteract;
} catch(e) {
alert("Could not print " + theImage);
} finally {
if (doc) {
doc.close(SaveOptions.DONOTSAVECHANGES);
}
}
Copy link to clipboard
Copied
Did some further testing with the client. I disabled calling the printOptions from doc.print(), and just using the default print option. In doing so, the file did not get corrupted. So, is there something that could be happening when the doc is being printed that would do this? Again, I am not saving the original doc after printing, so I have no idea why it would be getting corrputed. Thanks.
Copy link to clipboard
Copied
While we're waiting for someone who knows more, I'll ask a few questions if you don't mind.
Can you reproduce the issue yourself? Or does it only affect your client? Is it possibly a meta-data issue? Maybe that gets written automatically? Could you try saving the uncorrupted document as .ai with no compression, and compare it with the corrupted file using a file comparison tool? It would be interesting if the file content changed even though you didn't explicitly save it.
- Mark