https://bugs.kde.org/show_bug.cgi?id=496914

            Bug ID: 496914
           Summary: PDF created by Skanpage cannot be processed by
                    GhostScript "-dPDFSTOPONERROR"
    Classification: Applications
           Product: Skanpage
           Version: 24.08.3
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: a.stipp...@gmx.net
          Reporter: greenshadowma...@greenghost.net
  Target Milestone: ---

Created attachment 176276
  --> https://bugs.kde.org/attachment.cgi?id=176276&action=edit
problem PDF example created by skanpage

SUMMARY
PDF created by Skanpage may be malformed, generates error with GhostScript
"-dPDFSTOPONERROR" flag

Using paperless-ngx to import  a PDF created by skanpage.x86_64 24.08.3-1.fc41

from paperless error logs:
subprocess.CalledProcessError: Command '['gs', '-dQUIET', '-dSAFER', '-dBATCH',
'-dNOPAUSE', '-dInterpolateControl=-1', '-sDEVICE=jpeggray', '-dFirstPage=1',
'-dLastPage=1', '-r200.000000x200.000000', '-dPDFSTOPONERROR', '-o', '-',
'-sstdout=%stderr', '-dAutoRotatePages=/None', '-f',
'/tmp/ocrmypdf.io.bnzkaw75/origin.pdf']' returned non-zero exit status 1.

This is a known issue/behavior with some PDFs: 
https://docs.paperless-ngx.com/troubleshooting/#database-warns-about-unique-constraint-documents_tag_name_uniq
> https://github.com/ocrmypdf/OCRmyPDF/issues/1162
>> https://bugs.ghostscript.com/show_bug.cgi?id=707258
gs version 10.03.1

I can run the command manually:
gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -dInterpolateControl=-1 -sDEVICE=jpeggray
-dFirstPage=1 -dLastPage=1 -r300.000000x300.000000 -dPDFSTOPONERROR -o -
-sstdout=%stderr -dAutoRotatePages=/None  -f inputfile.pdf  > outfile.jpg

Where it will fail, and removing -dPDFSTOPONERROR and the command succeeds


STEPS TO REPRODUCE
1. Scan document with skanpage
    If any of this matters: (Epson ES-300W.  Scan source: ADF Duplex, scan
mode:color, bit depth 8bit, scan resolution 300, top left x&y 0, bottom right x
215.8,  bottom right y 279.4, ADF skew correction (checked), Scan area size:
Letter)
2. Save as PDF, or Export as PDF (same result with both)
3. use GS command to convert the pdf and observe failure: gs -dQUIET -dSAFER
-dBATCH -dNOPAUSE -dInterpolateControl=-1 -sDEVICE=jpeggray -dFirstPage=1
-dLastPage=1 -r300.000000x300.000000 -dPDFSTOPONERROR -o - -sstdout=%stderr
-dAutoRotatePages=/None  -f inputfile.pdf  > outfile.jpg
4. Remove "-dPDFSTOPONERROR" flag and observe success

OBSERVED RESULT
Failed conversion of pdf created by skanpage

EXPECTED RESULT
successful conversion of pdf created by skanpage

SOFTWARE/OS VERSIONS
$ kinfo
Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.8-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 4800H with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics


ADDITIONAL INFORMATION
Attaching example bad document pdf
Failed with 2 page (2 sided) or single page document.  attaching smaller single
side document that failed

Example output
$ gs -dQUIET -dSAFER -dBATCH -dNOPAUSE -dInterpolateControl=-1
-sDEVICE=jpeggray -dFirstPage=1 -dLastPage=1 -r300.000000x300.000000
-dPDFSTOPONERROR -o - -sstdout=%stderr -dAutoRotatePages=/None  -f
test-saveAll-pdfDocument-1page.pdf  > TEST-outfile.jpg
Error: /typecheck in --runpdf--
Operand stack:   --nostringval--   --nostringval--   --nostringval--  
--nostringval--
Execution stack:   %interp_exit   .runexec2   --nostringval--   runpdf  
--nostringval--   2   %stopped_push   --nostringval--   runpdf   runpdf   false
  1   %stopped_push   1933   1   3   %oparray_pop   1932   1   3   %oparray_pop
  1917   1   3   %oparray_pop   1918   1   3   %oparray_pop   runpdf   runpdf  
runpdf   runpdf
Dictionary stack:   --dict:754/1123(ro)(G)--   --dict:0/20(G)--  
--dict:86/200(L)--   --dict:6/10(L)--
Current allocation mode is local
GPL Ghostscript 10.03.1: Unrecoverable error, exit code 1
$

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to