我有大约1000个pdf文件,我需要将它们转换为300 dpi的tiff文件。 做这个的最好方式是什么? 如果存在可以编写脚本的SDK或其他工具或工具,那将是理想的。
将pdf文件转换为tiff文件的最佳方法[关闭]
Best way to convert pdf files to tiff files [closed]
===============>>#1 票数:55 已采纳
使用Imagemagick,或者更好的是Ghostscript。
http://www.ibm.com/developerworks/library/l-graf2/#N101C2有一个imagemagick的例子:
convert foo.pdf pages-%03d.tiff
http://www.asmail.be/msg0055376363.html有一个ghostscript的例子:
gs -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile=a.tif foo.pdf -c quit
我会安装ghostscript并阅读gs的手册页,看看需要哪些确切的选项和实验。
===============>>#2 票数:41
从命令行使用GhostScript,我在过去使用过以下内容:
在Windows上:
gswin32c -dNOPAUSE -q -g300x300 -sDEVICE=tiffg4 -dBATCH -sOutputFile=output_file_name.tif input_file_name.pdf
在* nix上:
gs -dNOPAUSE -q -g300x300 -sDEVICE=tiffg4 -dBATCH -sOutputFile=output_file_name.tif input_file_name.pdf
对于大量文件,可以使用简单的批处理/ shell脚本来转换任意数量的文件......
===============>>#3 票数:17
我写了一个小的PowerShell脚本来完成目录结构,并使用ghostscript将所有pdf文件转换为tiff文件。 这是我的脚本:
$tool = 'C:\Program Files\gs\gs8.63\bin\gswin32c.exe'
$pdfs = get-childitem . -recurse | where {$_.Extension -match "pdf"}
foreach($pdf in $pdfs)
{
$tiff = $pdf.FullName.split('.')[0] + '.tiff'
if(test-path $tiff)
{
"tiff file already exists " + $tiff
}
else
{
'Processing ' + $pdf.Name
$param = "-sOutputFile=$tiff"
& $tool -q -dNOPAUSE -sDEVICE=tiffg4 $param -r300 $pdf.FullName -c quit
}
}
===============>>#4 票数:8
1)安装GhostScript
2)安装ImageMagick
3)创建“Convert-to-TIFF.bat”(Windows XP,Vista,7)并使用以下行:
for %%f in (%*) DO "C:\Program Files\ImageMagick-6.6.4-Q16\convert.exe" -density 300 -compress lzw %%f %%f.tiff
将任意数量的单页PDF文件拖到此文件上会将它们转换为压缩的TIFF,速度为300 DPI。
===============>>#5 票数:7
使用python这是我最终得到的
import os
os.popen(' '.join([
self._ghostscriptPath + 'gswin32c.exe',
'-q',
'-dNOPAUSE',
'-dBATCH',
'-r300',
'-sDEVICE=tiff12nc',
'-sPAPERSIZE=a4',
'-sOutputFile=%s %s' % (tifDest, pdfSource),
]))
===============>>#6 票数:4
PDF Focus .Net可以这样做:
1. PDF到TIFF
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string pdfPath = @"c:\My.pdf";
string imageFolder = @"c:\images\";
f.OpenPdf(pdfPath);
if (f.PageCount > 0)
{
//Save all PDF pages to image folder as tiff images, 200 dpi
int result = f.ToImage(imageFolder, "page",System.Drawing.Imaging.ImageFormat.Tiff, 200);
}
2. PDF到Multipage-TIFF
//Convert PDF file to Multipage TIFF file
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string pdfPath = @"c:\Document.pdf";
string tiffPath = @"c:\Result.tiff";
f.OpenPdf(pdfPath);
if (f.PageCount > 0)
{
f.ToMultipageTiff(tiffPath, 120) == 0)
{
System.Diagnostics.Process.Start(tiffPath);
}
}
===============>>#7 票数:3
必需的ghostscript和tiffcp在Ubuntu中测试过
import os
def pdf2tiff(source, destination):
idx = destination.rindex('.')
destination = destination[:idx]
args = [
'-q', '-dNOPAUSE', '-dBATCH',
'-sDEVICE=tiffg4',
'-r600', '-sPAPERSIZE=a4',
'-sOutputFile=' + destination + '__%03d.tiff'
]
gs_cmd = 'gs ' + ' '.join(args) +' '+ source
os.system(gs_cmd)
args = [destination + '__*.tiff', destination + '.tiff' ]
tiffcp_cmd = 'tiffcp ' + ' '.join(args)
os.system(tiffcp_cmd)
args = [destination + '__*.tiff']
rm_cmd = 'rm ' + ' '.join(args)
os.system(rm_cmd)
pdf2tiff('abc.pdf', 'abc.tiff')
===============>>#8 票数:3
ABCPDF也可以这样做 - 退房 http://www.websupergoo.com/helppdf6net/default.html
===============>>#9 票数:2
pdf2tiff怎么样? http://python.net/~gherman/pdf2tiff.html
===============>>#10 票数:2
https://pypi.org/project/pdf2tiff/
您还可以使用pdf2ps,ps2image,然后将生成的图像转换为tiff与其他实用程序(我记得'保罗'[保罗 - 又一个图像查看器(显示PNG,TIFF,GIF,JPG等))
===============>>#11 票数:2
也许还试试这个? PDF焦点
这个.Net库允许你解决问题:)
此代码将有所帮助(将1000个PDF文件转换为C#中的300-dpi TIFF文件):
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
string[] pdfFiles = Directory.GetFiles(@"d:\Folder with 1000 pdfs\", "*.pdf");
string folderWithTiffs = @"d:\Folder with TIFFs\";
foreach (string pdffile in pdfFiles)
{
f.OpenPdf(pdffile);
if (f.PageCount > 0)
{
//save all pages to tiff files with 300 dpi
f.ToImage(folderWithTiffs, Path.GetFileNameWithoutExtension(pdffile), System.Drawing.Imaging.ImageFormat.Tiff, 300);
}
f.ClosePdf();
}
===============>>#12 票数:2
免责声明:为我推荐的产品工作
Atalasoft有一个可以将PDF转换为TIFF的.NET库 - 我们是FOXIT的合作伙伴,所以PDF渲染非常好。
===============>>#13 票数:1
我喜欢PDFTIFF.com 将PDF转换为TIFF ,它可以处理无限页面