أفضل طريقة لتحويل ملفات pdf إلى ملفات tiff [مغلقة]

StackOverflow https://stackoverflow.com/questions/75500

  •  09-06-2019
  •  | 
  •  

سؤال

لدي حوالي 1000 pdf filesand أنا بحاجة إلى تحويلها إلى 300 نقطة في البوصة ملفات tiff.ما هي أفضل طريقة للقيام بذلك ؟ إذا كان هناك SDK أو شيء أو الأداة التي يمكن كتابتها أن تكون مثالية.

هل كانت مفيدة؟

المحلول

استخدام يماغيماغيك أو الأفضل من ذلك ، غوستسكريبت.

http://www.ibm.com/developerworks/library/l-graf2/#N101C2 له مثال imagemagick:

convert foo.pdf pages-%03d.tiff

http://www.asmail.be/msg0055376363.html له مثال غوستسكريبت:

gs -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile=a.tif foo.pdf -c quit

وأود أن تثبيت غوستسكريبت وقراءة صفحة من أجل gs لمعرفة بالضبط ما هي الخيارات اللازمة و التجربة.

نصائح أخرى

باستخدام غوستسكريبت من سطر الأوامر ، لقد استعملت ما يلي في الماضي:

على ويندوز:

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

على عدد كبير من الملفات, بسيطة دفعة/قذيفة النصي يمكن أن تستخدم لتحويل عدد التعسفي من الملفات...

كتبت القليل النصي powershell أن تذهب من خلال بنية الدليل و تحويل جميع ملفات 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
    }
}

1) تثبيت غوستسكريبت

2) تثبيت ImageMagick

3) إنشاء "تحويل إلى TIFF.الخفافيش" (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 على هذا الملف سوف تحويلها إلى ضغط المشاجرات في 300 نقطة في البوصة.

باستخدام بيثون هذا هو ما انتهى مع

    import os
    os.popen(' '.join([
                       self._ghostscriptPath + 'gswin32c.exe', 
                       '-q',
                       '-dNOPAUSE',
                       '-dBATCH',
                       '-r300',
                       '-sDEVICE=tiff12nc',
                       '-sPAPERSIZE=a4',
                       '-sOutputFile=%s %s' % (tifDest, pdfSource),
                       ]))

PDF التركيز .صافي يمكن أن تفعل ذلك في مثل هذه الطريقة:

1. PDF to 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 متعددة الصفحات-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);
    }
}   

ABCPDF يمكن أن تفعل ذلك أيضا-تحقق من http://www.websupergoo.com/helppdf6net/default.html

مطلوب غوستسكريبت & tiffcp اختبار في أوبونتو

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')

http://python.net/~غيرمان/المشاريع/pdf2tiff/

هل يمكن أيضا استخدام pdf2ps, ps2image ثم التحويل من الصورة الناتجة إلى tiff مع المرافق الأخرى (أتذكر 'بول' [بول - آخر عارض الصور (يعرض PNG, TIFF, GIF, JPG, إلخ])

تنويه:العمل المنتج أوصي

Atalasoft لديه .مكتبة الشبكة التي يمكن أن convert PDF to TIFF - نحن شريك من قراء لذا PDF التقديم هو جيد جدا.

ربما أيضا محاولة هذا ؟ PDF التركيز

هذا .مكتبة الشبكة يسمح لك حل المشكلة :)

هذا القانون سوف يساعد (تحويل 1000 ملفات PDF إلى 300 نقطة في البوصة TIFF ملفات في C#):

    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();
    }

أحب PDFTIFF.com إلى convert PDF to TIFF, ، فإنه يمكن التعامل مع صفحات غير محدود

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top