我有一个PDF文件,我想在Linux上进行后期处理.特别是我想:
使用Windows,可以使用Adobe Distiller执行这两个步骤(打开文档文件并将其打印到具有相应设置的新PDF文档中).
在Linux上我可以使用Ghostscript [1]来配置字体,但它似乎不能用Type 1字体替换(所有?)Type 3字体或者组合相同字体的多个子集.
关于如何使用免费工具实现这两项任务的任何提示?
(我知道如何将Type 3字体转换为PDF格式的Type 1字体.但是,我真的不在乎理论上是否丢失了有关字体的信息,因为此对话在Distiller中似乎工作正常).
[1]参数:
gs -dPDFA -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH \
-sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 \
-dMaxSubsetPct=100 -dSubsetFonts=true \
-dEmbedAllFonts=true -sOutputFile=/tmp/tmp.pdf -f "$1"
Run Code Online (Sandbox Code Playgroud) 我正在使用Dompdf从html模板和Pdfnup(Pdfjam的一部分)生成A5 pdf文档,将它们组合成一张漂亮的单张A4纸,这有助于在打印时节省一些纸张:)
# Generate an a5 pdf
php dompdf.php mytemplate.html -p 'A5' -f a5doc.pdf
# combine two copies of the generated A5 into a single A4 page
pdfnup a5doc.pdf a5doc.pdf --nup '2x1'
Run Code Online (Sandbox Code Playgroud)
这很好用; 虽然第二步迫使我安装大量的依赖项(即Tex-Latex,pdftex,ecc.)并且会混乱我的生产服务器.我想知道是否有任何方法来组合生成的文件而不实际使用Pdfnup.例如,有没有办法用pdftk这样做?
先感谢您!
简而言之,我正在处理一个有问题的PDF,其中:
evince由于缺少字体信息,无法在文档查看器中完全呈现;ghostscript可以完全呈现相同的PDF.因此 - 无论ghostscript填写空白的用途(可能是后备字形,或访问字体的不同方法) - 我希望能够ghostscript用来生成("提取")输出PDF,其中几乎除了添加的字体信息之外,什么都不会改变,因此evince可以以相同的方式呈现相同的文档ghostscript.
因此,我的问题是 - 这是否可行; 如果是这样,那么命令行会是什么样的呢?
非常感谢任何答案,
干杯!
我实际上是在一个较旧的Ubuntu 10.04,我可能正在经历 - 不是一个错误 - 但安装问题evince(缺少poppler-data包),如Bug#386008中所述"由于"未知的字体标记,某些字体无法显示. ..:"Bugs:"poppler"包:Ubuntu.
但是,这正是我想要处理的内容,因此我将使用fontspec.pdf附加到该帖子(" PDF触发错误. ",//v.)来演示问题.
evince首先,我打开这个pdf的第3页evince; 并evince抱怨:
$ evince --page-label=3 fontspec.pdf
Error: Missing language pack for 'Adobe-Japan1' mapping
Error: Unknown font tag 'F5.1'
Error (7597): No font …Run Code Online (Sandbox Code Playgroud) 我的项目给出错误..
*无法在DLL"gsdll32.dll"中找到名为"gsapi_new_instance"的入口点.*
尝试使用Ghost-script Interpreter dll'gsdll32.dll'将.pdf转换为图像格式时
即使我尝试将这个dll复制到所有想要的地方,就像在许多论坛中所说的那样
Win\System32或在项目的目录..错误保持不变.. :(
我使用了Ghost-script给出的PDFConvert.cs类,并在我的转换按钮上编写了以下代码:
private void btnConvert_Click(object sender, RoutedEventArgs e)
{
//First We Check whether the Dll is present
if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\gsdll32.dll"))
{
MessageBox.Show("The library 'gsdll32.dll' required to run this program is not present! download GhostScript and copy \"gsdll32.dll\" to this program directory");
return;
}
if (string.IsNullOrEmpty(txtSingleFile.Text))
{
MessageBox.Show("Enter the File name");
txtSingleFile.Focus();
return;
}
else if (!File.Exists(txtSingleFile.Text))
{
MessageBox.Show("The File Does not exists");
txtSingleFile.Focus();
}
else
ConvertPdfToImage(txtSingleFile.Text);
}
Run Code Online (Sandbox Code Playgroud)
和我的ConvertPdfToImage方法如下:
//The Ghost-Script Class Object …Run Code Online (Sandbox Code Playgroud) 我正在使用Ghost4J SimpleRenderer将我的PDF转换为Image.默认情况下,输出png图像不是抗锯齿.
我怎么设置它.
我知道,使用Core API我们可以做到.但是,在高级API中是否有任何方法可以设置它?
以下命令在pdf文件上执行ghostscript.(该pdf_file变量包含该pdf的路径)
bbox <- system(paste( "C:/gs/gs8.64/bin/gswin32c.exe -sDEVICE=bbox -dNOPAUSE -dBATCH -f", pdf_file, "2>&1" ), intern=TRUE)
Run Code Online (Sandbox Code Playgroud)
执行后bbox包含以下字符串.
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 …Run Code Online (Sandbox Code Playgroud) 我在OS X(10.8.4)上使用GPL Ghostscript 9.07(2013-02-14)将许多PDF转换为PNG.
除了其中一个变成带有锯齿状边缘的PNG之外,它工作正常.换句话说,由于某种原因,Ghostscript关闭了针对该特定PDF的抗锯齿.
输出:

我用这个命令:
gs -dNOPAUSE -dBATCH -dPDFFitPage -sDEVICE=pngalpha -g200x150 -sOutputFile=01.png 01.pdf
Run Code Online (Sandbox Code Playgroud)
是否可以强制Ghostscript对该PDF使用抗锯齿?
任何提示都表示赞赏.
尝试在新Macbook上安装八度音,但使用Homebrew时遇到问题.我在这里遵循指示:http: //wiki.octave.org/Octave_for_MacOS_X
我遇到了错误:
Linking /usr/local/Cellar/ghostscript/9.14...
Error: Could not symlink share/ghostscript/Resource
/usr/local/share/ghostscript is not writable.
Run Code Online (Sandbox Code Playgroud)
进入后:
sudo chown -R username:admin /usr/local/bin
brew link ghostscript
Run Code Online (Sandbox Code Playgroud)
我仍然得到同样的错误.如何使ghostscript可写?
我想在PDF文档中以编程方式更改背景颜色和文本颜色,以便在晚上更好地阅读(有点像Adobe Reader:编辑 - >首选项 - >辅助功能 - >替换文档颜色).
是否有适用于Windows的良好命令行工具或API可以做到这一点?
到目前为止,我还没有找到任何.如果需要将新着色的PDF保存到新文件中,则可以.
我正在使用 Ghostscript 9.20 从仅包含两行文本的 PDF 文档中提取文本:
\n\nHello world\xe2\x80\xa6\nA beautiful day!\nRun Code Online (Sandbox Code Playgroud)\n\n应用的代码是:
\n\ngswin32c -sDEVICE=txtwrite -o output.txt input.pdf\nRun Code Online (Sandbox Code Playgroud)\n\n然而,输出是:
\n\n \xe4\xa0\x80\xe6\x94\x80\xe6\xb0\x80\xe6\xb0\x80\xe6\xbc\x80\xe2\x80\x80\xe7\x9c\x80\xe6\xbc\x80\xe7\x88\x80\xe6\xb0\x80\xe6\x90\x80\xe2\x98\xa0\xe2\x80\x80\n \xe4\x84\x80\xe2\x80\x80\xe6\x88\x80\xe6\x94\x80\xe6\x84\x80\xe7\x94\x80\xe7\x90\x80\xe6\xa4\x80\xe6\x98\x80\xe7\x94\x80\xe6\xb0\x80\xe2\x80\x80\xe6\x90\x80\xe6\x84\x80\xe7\xa4\x80\xe2\x84\x80\xe2\x80\x80\nRun Code Online (Sandbox Code Playgroud)\n\n这是怎么回事?我该如何解决?
\n