gpt4 book ai didi

pdf - GhostScript 命令从 PDF 文件创建缩略图

转载 作者:行者123 更新时间:2023-12-04 21:56:10 26 4
gpt4 key购买 nike

我正在尝试从 PDF 文件创建缩略图。我能够从下面的命令生成 JPEG 图像,但问题是我无法将输出图像的大小调整为固定大小( 250x250 )

命令 -dPDFFitPage=true 使输出图像适合给定的尺寸,并且图像显示为旋转。谁能帮我解决这个问题,为 250x250 大小的 PDF 文件生成缩略图。

/usr/bin/gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -sOutputFile=<path to output file>%d.jpeg -dJPEGQ=100 -g250x250 -dUseCropBox=true  -dPDFFitPage=true -q  <path to input file>.pdf -c quit

谢谢
萨钦

GhostScript 9.15 版本出错

根据建议,我已经安装了 Ghostscript 9.15 版本。但安装后,我通过的任何命令都会出错。如何纠正或检查 GS 9.15 是否已正确安装。
 **** Error reading a content stream. The page may be incomplete.
**** File did not complete the page properly and may be damaged.
Error: /ioerror in --showpage--
Operand stack:
1 true
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1945 1 3 %oparray_pop 1944 1 3 %oparray_pop 1928 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- 1826 0 11 %oparray_pop --nostringval-- --nostringval--
Dictionary stack:
--dict:1187/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82/200(L)-- --dict:116/127(ro)(G)-- --dict:280/300(ro)(G)-- --dict:30/32(L)-- --dict:6/8(L)-- --dict:21/40(L)-- --dict:1/1(ro)(G)-- --dict:7/17(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.15: Unrecoverable error, exit code 1
Unrecoverable error: typecheck in setpagedevice

最佳答案

下面的代码对我有用:

gs -sDEVICE=jpeg -dPDFFitPage=true -dDEVICEWIDTHPOINTS=250 -dDEVICEHEIGHTPOINTS=250 -sOutputFile=outputfile.jpeg inputfile.pdf

-dDEVICEWIDTHPOINTS=pixels
-dDEVICEHEIGHTPOINTS=pixels

关于pdf - GhostScript 命令从 PDF 文件创建缩略图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26383405/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com