(최적화하면서 또는, 고스트 스크립트는 8 비트 RGB 실패), 그래서, ghostscript
를 사용하여 시도 같이 호출 :PDF의 이미지 만 다시 인코딩 하시겠습니까? 내가 파일 크기 큰 PDF 문서의 수를 최적화해야
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -sOutputFile=output-my-doc.pdf input-my-doc.pdf
내가 할 수있는 일부 페이지에서는 실행 중이지만 특정 페이지에서는 충돌합니다.
gs
버전 9.02로 업데이트되었으며 동일한 결과를 얻었습니다. 문서를 별도의 페이지로 분할하고 각 페이지에서 위의 명령을 실행하면 문제가있는 페이지를 확인할 수있었습니다. 실제로, 내가 단지 gs input-my-doc-pageX.pdf
라고해도 오류가 발생합니다. 이것은 뷰어를 시작하고, 이미지가 추락 할 때까지 텍스트를 조판 할 수 있습니다.
내 경우에 특정 이미지에서 gs
이 작동을 멈추었 음을 확인했습니다. 그리고 마지막으로 문제를 나타내는 최소한의 작업 (또는 작동하지 않는) 예제를 제공 할 수도 있습니다. 특히 문제는 특정 방식으로 지정된 8 비트 RGB 이미지 인 것 같습니다. 이 버그의 경우 지금
, 나는 말할 수 없다, 그러나 나는이 작업을 수행하는 데 필요한 때문에 - 나는 응용 프로그램을 통해 PDF 파일을 실행하여, 어쩌면 내가 ghostscript
를 "속임수"수 있다고 생각하는 이미지를 단일 형식 (예 : PNG)으로 다시 인코딩한다는 점을 제외하고는 PDF를 그대로 둡니다. 따라서 gs
옵티마이 저는 충돌없이 이러한 파일을 실행할 수 있습니다.
Linux에서 명령 줄을 사용하여 주어진 PDF 이미지 만 다시 인코딩해야하는 옵션은 무엇입니까?
미리 답변 해 주셔서 감사합니다.
건배!
PS는 : 테스트 케이스는 기본적 포스트에 source-code PDF example이다 Imagemagick: generate raw image data for PDF flate embedding?. PDF (hello2.pdf
가) 말에 잘 열립니다
, evince
: 그것은 외부 참조 테이블이 손상 이후
은 ...하지만, 나는 그것을 수리 :
$ pdftk hello2.pdf output hello2O.pdf
$ qpdf --check hello2O.pdf
checking hello2O.pdf
PDF Version: 1.4
File is not encrypted
File is not linearized
No errors found
수리 된 파일 hello2O.pdf
도 evince
에 잘 열립니다. 그러나 위의 gs
최적화 명령을 실행하려고하면 오류가 발생합니다.
$ gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dBATCH -sOutputFile=optihello2O.pdf hello2O.pdf
GPL Ghostscript 9.02 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Loading NimbusSanL-Regu font from /usr/share/ghostscript/9.02/Resource/Font/NimbusSanL-Regu... 2756020 1410650 1869284 568021 3 done.
Error: /undefined in --run--
Operand stack:
--dict:6/15(L)-- false --dict:11/19(L)-- --dict:4/4(L)-- --nostringval-- FlateDecode --dict:4/4(L)-- 0
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1910 1 3 %oparray_pop 1909 1 3 %oparray_pop 1893 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- 576 --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval--
Dictionary stack:
--dict:1160/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82/200(L)-- --dict:108/127(ro)(G)-- --dict:295/300(ro)(G)-- --dict:23/30(L)-- --dict:6/8(L)-- --dict:25/40(L)-- --dict:7/17(L)--
Current allocation mode is local
GPL Ghostscript 9.02: Unrecoverable error, exit code 1