我需要将我的PDF文件中的某个部分裁剪为PNG(这将使用Ghostscript与PHP自动完成).这就是我现在所做的,基本上将PDF的第一页转为PNG:
gs -q -dNOPAUSE -dBATCH \
-sDEVICE=pngalpha -dEPSCrop \
-sOutputFile=output.png input.pdf
Run Code Online (Sandbox Code Playgroud)
具体来说,我正试图将这个左上角的卡片裁剪为PNG.我也愿意就如何实现这一目标提出更多建议.
你能告诉我如何使用Ghostscript或Postscript将TIFF转换为PDF?
我试着使用这个命令:
gswin32c.exe -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=o.pdf test.tif
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
它会产生错误:
GPL Ghostscript 9.06 (2012-08-08) Copyright (C) 2012 Artifex Software, Inc. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. Error: /undefined in II* Operand stack: 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 1787 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push …
在Mac Lion上,我完成了配置,制作和安装ImageMagick的静态版本.一切都很顺利,因为配置我得到了
configuring ImageMagick 6.7.2-4 checking build system type... x86_64-apple-darwin11.1.0 checking host system type... x86_64-apple-darwin11.1.0 checking target system type... x86_64-apple-darwin11.1.0 ....
但是当我尝试在我自己的应用程序中使用静态库时,链接器会向我发送数百个链接错误,例如...
Undefined symbols for architecture x86_64:
"_XOpenDisplay", referenced from:
_RenderType in libMagickCore.a(magick_libMagickCore_la-annotate.o)
_DisplayImages in libMagickCore.a(magick_libMagickCore_la-display.o)
...
"_XInitImage", referenced from:
_ReadXWDImage in libMagickCore.a(magick_libMagickCore_la-xwd.o)
ld: symbol(s) not found for architecture x86_64
这是我的LIBS声明
LIBS += -L/Library/ImageMagick-6.7.2-4/magick/.libs \ -L/Library/ImageMagick-6.7.2-4/magick \ -L/Library/ImageMagick-6.7.2-4/wand/.libs \ -L/Library/ImageMagick-6.7.2-4/wand \ -L/usr/X11/lib \ -R/usr/X11/lib \ -L/opt/local/lib \ -L/opt/lib \ -lMagick++ \ -lMagickCore \ -lMagickWand \ -ltiff \ -lfreetype \ -ljpeg …
我正在使用 Ghostscript 通过命令行参数打印 PDF。但它在打印机后台处理程序中将打印文档的名称显示为 Ghostscript 输出。我想将其更改为自定义名称(作为字母名称)。
我有一个PHP站点,需要PDF到图像转换,我们显然使用imagemagick.但是,现在我们正在尝试迁移到不同的托管,似乎我将无法在新托管上安装imagemagick软件包来执行与现在相同的操作.
所以问题是 - 是否有任何方法可以使用纯PHP方法将PDF转换为图像,或者使用其他任何可以刚刚弹出到DOCUMENT_ROOT并且无需正确安装到系统中的方法.
这是一个Linux系统,但我不知道是什么发行版,我无法检查,因为我在这个系统中的权利真的有限.
谢谢Alex.
我正在使用ImageMagick创建一个PDF的拇指.
/opt/local/bin/convert \
"$inputFile[0]" \
-geometry 157x200 \
-colorspace RGB \
"$ThumbFile"
Run Code Online (Sandbox Code Playgroud)
但最后我们得到了带有"裁剪标记"的PDF(用于出血).
有没有我可以选择不选择的选项?
我怎样才能做到这一点?
例:

我想只有第二张图片的内容.
我是使用reveal.js的新手。
我没有设法减少幻灯片顶部的空间。有人可以帮我吗?
注意:我正在使用pandocMarkdown来源创建幻灯片。这是我使用的命令行:
pandoc -s -f markdown+tex_math_single_backslash \
--bibliography=bibliography.bib --filter pandoc-citeproc \
--slide-level 2 --toc --mathjax -i -t revealjs -V theme:beige \
-H mysettings.css mfront.md -o mfront.html
Run Code Online (Sandbox Code Playgroud)
这是生成的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="author" content="Thomas Helfer" />
<meta name="dcterms.date" content="2014-01-01" />
<title>MFront User Meeting: TFEL 2.0 and beyond</title>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="reveal.js/css/reveal.min.css"/>
<style type="text/css">code{white-space: pre;}</style>
<style type="text/css">
table.sourceCode, tr.sourceCode, td.lineNumbers, …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过Ubuntu上的命令行将.xls文件转换为.pdf使用LibreOffice.我有一个关于.xls文件的报告,在单元格的背景中有一些颜色等.
问题是当我转换.xls文件时,.pdf丢失了原始格式.每个页面几乎在一半中断,一页的内容显示在两个不同的页面中.
.xls文件转换为.pdf命令行?.pdf页面的大小不打破页面?(也可以通过命令行)我用来进行转换的代码是:
soffice --headless --convert-to pdf:"impress_pdf_Export" filename.xls
Run Code Online (Sandbox Code Playgroud) 我想尝试手动编写PostScript文件.为什么?为什么不.从维基百科,我复制并粘贴了他们的基本Hello World程序,PostScript其中包括:
%!PS
/Courier % name the desired font
20 selectfont % choose the size in points and establish
% the font as the current one
72 500 moveto % position the current point at
% coordinates 72, 500 (the origin is at the
% lower-left corner of the page)
(Hello world!) show % stroke the text in parentheses
showpage % print all on the page
Run Code Online (Sandbox Code Playgroud)
当我试图打开它时GIMP,我明白了
打开'Hello World.ps'失败了.无法解释文件'Hello World.ps'
我可以ImageMagick用来转换文件
convert …Run Code Online (Sandbox Code Playgroud) 在 Unix 或 Windows 中,我想将此字典转换为 Python dictionary。我复制了PDF字典的内容并将它们放在一个.rtf文件中,打算read用 Python来处理它们。但是,它给出了类似的东西:
A /e?/ 名词 ABO 系统的人类血型,含有 A 抗原(注意:A 型的人可以捐献给同一组或 AB 组的人,并且可以从具有 A 型的人那里接受血液A 型或 O 型。)
AA
腹胀 /bd?m?n(?)ld?s十?(?)n/ 名词 腹部
因气体或液体而伸展的情况
A
腹胀
AA 缩写 酗酒者匿名的
它基本上将 PDF 中的列压缩成奇怪的混杂。如何将 PDF 转换为文本以便尊重列?换句话说,所需的输出是:
A /e?/ 名词 ABO 系统的人类血型,含有 A 抗原(注意:A 型的人可以捐献给同一组或 AB 组的人,并且可以从具有 A 型的人那里接受血液A 型或 O 型。)
AA 缩写 戒酒匿名
...等等
pdf ×7
ghostscript ×4
imagemagick ×4
bash ×2
php ×2
postscript ×2
excel ×1
gimp ×1
image ×1
libreoffice ×1
linux ×1
png ×1
python ×1
reveal.js ×1
tiff ×1
xls ×1