다음 명령은 pdf 파일에서 ghostscript를 실행합니다. 실행 후 bbox
R 스크립트가 자동화 된 경우 다른 결과
bbox <- system(paste("C:/gs/gs8.64/bin/gswin32c.exe -sDEVICE=bbox -dNOPAUSE -dBATCH -f", pdf_file, "2>&1"), intern=TRUE)
가 다음 문자열을 포함합니다 (pdf_file
변수는 PDF 경로를 포함).
GPL Ghostscript 8.64 (2009-02-03)
Copyright (C) 2009 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
%%BoundingBox: 36 2544 248 2825
%%HiResBoundingBox: 36.395015 2544.659922 247.070032 2824.685914
Error: /undefinedfilename in (2>&1)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1147/1684(ro)(G)-- --dict:1/20(G)-- --dict:69/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
이 문자열
이어서 BoundingBox의 크기 (36 2,544 248 2,825) 절연 PDF 파일 자르기 사용하기 위해서는 조작된다. 지금까지 모든 것이 잘 작동합니다.그러나 작업 관리자 (Rscript.exe 또는 Rcmd.exe BATCH 사용)에서이 스크립트를 예약하거나 스크립트가 R 청크 안에 있고 knit HTML
을 누르면 bbox는 BoundingBox가없는 다음 문자열을 가져옵니다 정보를 제공하고 사용할 수 없게 만듭니다.
GPL Ghostscript 8.64 (2009-02-03)
Copyright (C) 2009 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
Error: /undefinedfilename in (2>&1)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1147/1684(ro)(G)-- --dict:1/20(G)-- --dict:69/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
이 문제를 극복하고 스크립트를 자동으로 실행 시키려면 어떻게해야합니까?
(스크립트는 that question에 허용 대답에서 유래) 장치의 출력은 표준 출력 것입니다
처럼, 쉘이 해석 만들려면
, 당신은
cmd /c
으로 명령을 앞에해야합니다 나는 프로세스 생성을보고 procmon을 사용 stderr, 이고'2> & 1'은 stderr을 stdout으로 재 지정합니다. 하지만이 구문은 Windows에서 인식되지 않습니다. –Windows 명령 프로세서에서 인식하지만 명령 셸에서 실행되지 않으므로 리디렉션이 수행되지 않습니다. – KenS
'pdf_file'은 PDF의 전체 경로를 포함합니까? – robertklep