Creating a PDF from the terminal

Using this terminal command (part of a handler)

  set terminalCommand to ""
       set convertCommand to "/System/Library/Printers/Libraries/./convert "
       set newFileName to removeExt(this_item) & ".pdf"
       set terminalCommand to convertCommand & "-f " & "\"" & this_item & "\"" & " -o " & "\"" & newFileName & "\"" & " -j \"application/pdf\""
       do shell script terminalCommand

Is it possible to adjust the compression level of the resulting PDF?
ta!!

Running 10.3.9?

Maybe applying a quartz filter at the final stage of the process inside the script?

/System/Library/Printers/Libraries/quartzfilter $in $filter $out

http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh1589.html

for details./

HTH

Thanks for the suggestion but I’m not sure how to imtegrate it in my script. Here’s what I’ve got so far, can someone please show me how to use the above in my script utilizing the built in “Reduce File Size” filter in ColorSync Utility?
Thanks!!

on open these_items
	repeat with theitem in these_items
		set this_item to theitem
		set theFilePath to theitem as string
		set thePOSIXFilePath to POSIX path of theFilePath as string
		processFile(thePOSIXFilePath)
	end repeat
end open

on processFile(this_item)
	try
		set terminalCommand to ""
		set convertCommand to "/System/Library/Printers/Libraries/./convert "
		set newFileName to removeExt(this_item) & ".pdf"
		set terminalCommand to convertCommand & "-f " & "\"" & this_item & "\"" & " -o " & "\"" & newFileName & "\"" & " -j \"application/pdf\""
		
		do shell script terminalCommand
	end try
end processFile

on removeExt(thisItem)
	set thisItem to thisItem as text
	set myOffset to offset of "." in (reverse of characters in thisItem as text)
	if myOffset ≠ 0 then set thisItem to characters 1 thru -(myOffset + 1) of thisItem as text
	return thisItem
end removeExt