Summary: | When sOutputFile is used, redirect errors to stderr | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Seb35 <sebcvhipss30> |
Component: | General | Assignee: | Default assignee <ghostpdl-bugs> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | ||
Priority: | P4 | ||
Version: | master | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: | Pdf issuing warning when converted to JPEG by imagemagick |
Description
Seb35
2019-10-22 11:43:47 UTC
(In reply to Seb35 from comment #0) > When a PDF file is not completely compliant and "-sOutputFile=-" is used, > warnings are included in the standard output, corrupting the output file. > These warnings should instead be redirected to the standard error. Warnings are not errors, so no. The PDF interpreter (being written in PostScript) has always worked in this fashion. I'd recommend that you don't pipe the output to stdout, many devices won't work properly if you do that anyway. Well, in the meantime (thanks for the quick answer), I just found myself how to do it by adding the parameter -sstdout=%stderr, redirecting the actual image to stdout and errors to stderr. Sorry for the noise. For reference, the original bug was on MediaWiki https://phabricator.wikimedia.org/T50007, I will propose such commit there. (In reply to Seb35 from comment #2) > Well, in the meantime (thanks for the quick answer), I just found myself how > to do it by adding the parameter -sstdout=%stderr, redirecting the actual > image to stdout and errors to stderr. I haven't tried it, but you will probably want to set -sOutputFile *before* you do that. Ghostscript processes command line options sequentially, if you redirect stdout to stderr before you set the output file to stdout, you may find that it ends up also being redirected to stderr. Or it may not, like I say I have not checked and its possible that '-' ignores any such redirection. I'd need to plough through the code to find out > Sorry for the noise. Not a problem, and thanks for posting the follow up. > For reference, the original bug was on MediaWiki > https://phabricator.wikimedia.org/T50007, I will propose such commit there. That would be good, thanks. I just tried both ways '-sstdout=%stderr' before and after '-sOutputFile=-' and it works equally with my example. But I will follow your advice, there could be more strange files out there. |