sorenvang
(SorenVang)
1
Description
Script to compress PDF files
Based on Duality’s PDF to TIFF converter… with a few modifications.
You will need ghostscript installed for this to work…
Source Code
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
}
}
#Path to your Ghostscript EXE
$tool = 'C:\\Program Files\\Bullzip\\PDF Printer\\gs\\gswin32c.exe'
#Directory containing the PDF files that will be converted
$inputDir = Select-Folder 'Select folder with originals!'
#Output path where the TIF files will be saved
$outputDir = Select-Folder 'Select folder for compressed PDF!'
$result1 = $outputDir -replace "\\","\\"
$outputDir = $result1 + "\\"
$result = $inputDir -replace "\\","\\"
$inputDir = $result + "\\"
$pdfs = get-childitem $inputDir -recurse | where {$_.Extension -match "pdf"}
#Used for calculating progress bar
$i = 0
$cnt = (Get-ChildItem $inputDir).Count
foreach($pdf in $pdfs)
{
$tif = $outputDir + $pdf.BaseName + ".pdf"
cls
Write-Progress -Activity "Processing: $i/$cnt $pdf" -Status "Progress:" -PercentComplete ($i/$cnt*100)
if(test-path $tif)
{
"pdf file already exists " + $tif
}
else
{
'Processing ' + $pdf.Name
$param = "-sOutputFile=$tif"
$prep = "-dPDFSETTINGS=/screen -dCompatibilityLevel=1.4"
& $tool -q -dNOPAUSE -sDEVICE=pdfwrite $param $pdf.FullName -c quit
}
$i++
}
Screenshots

Hi! My company and I used this PDF compressor and it worked very well! PDF Software & Tools Tailored to Your Business | Foxit
You can try ZetPDF.com software that has the fastest PDF solutions.