Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- convert foo.pdf pages-%03d.tiff
- gs -q -dNOPAUSE -sDEVICE=tiffg4 -sOutputFile=a.tif foo.pdf -c quit
- $tool = 'C:Program Filesgsgs8.63bingswin32c.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
- }
- }
- import os
- os.popen(' '.join([
- self._ghostscriptPath + 'gswin32c.exe',
- '-q',
- '-dNOPAUSE',
- '-dBATCH',
- '-r300',
- '-sDEVICE=tiff12nc',
- '-sPAPERSIZE=a4',
- '-sOutputFile=%s %s' % (tifDest, pdfSource),
- ]))
- for %%f in (%*) DO "C:Program FilesImageMagick-6.6.4-Q16convert.exe" -density 300 -compress lzw %%f %%f.tiff
- 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')
- 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);
- }
- //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);
- }
- }
- 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();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement