On Sun, 2011-01-02 at 03:05 +0000, Michael Fothergill wrote: <snip> > So I gave up with Acrobat and used the ghostscript command gs > -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen > -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf which > worked really well and made a smaller pdf file for me. <snip>
This looked useful to some of our clients who use Windows primarily for Acrobat and principally to reduce PDF file sizes. So we created a KDE service menu so that they could simply right click on a PDF file, go to Actions, and choose Reduce PDF File(s). I don't recall if Acrobat calls this Reduce or Optimize. In case it may be of use to anyone else, here's how we did it: We wrapped the command in a script to create user dialogs, handle spaces in file names, etc., named reducepdf: #!/bin/bash OFILE="" OK=true FILES="\"$(echo "${1}" | sed 's/ \//\" \"\//g')\"" DIR="$(echo ${FILES} | sed 's/\"\([^\"]*\)\".*/\1/')" DIR="${DIR%/*}/" EXT="" while ${OK} do OFILE="$(kdialog --title "Enter New Reduced PDF File Name" --getsavefilename ${DIR})" if [ $? -ne 0 ];then exit 4 fi EXT="${OFILE: -4:4}" if [ "${EXT}" != ".pdf" -a "${EXT}" != ".PDF" ];then OFILE="${OFILE}.pdf" fi if [ -f "${OFILE}" ];then kdialog --title "Reduce PDF File" --warningyesno "The file ${OFILE} already exists.\nShall I overwrite it?" if [ $? -ne 0 ];then continue fi fi OK=false done kdialog --title "Reduce PDF File" --msgbox "PDF reduction can take several minutes.\nPlease wait until you see the Reduction Completed message\nbefore opening the new, reduced file.\nThe file may appear in your file manager before it is ready\nbut you will receive a file damaged error message\nif you open it too soon." & eval gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=\"${OFILE}\" ${FILES} kdialog --title "Reduce PDF File" --msgbox "PDF Reduction Completed for: \n${OFILE}" We created the service menu in <KDEDIR>/share/apps/konqueror/servicemenus/39748-reducepdf.desktop [Desktop Action Reduce_PDF] Exec=<path to>/reducepdf "%F" Icon=acroread Name=Reduce PDF file(s) [Desktop Entry] Actions=Reduce_PDF Encoding=UTF-8 ServiceTypes=application/pdf,application/vnd.adobe.pdf As you can tell from the messages, we hit a bit of a problem. Ghostscript creates the new file and then takes a while to finish writing to it. Unfortunately, Konqueror displays the file immediately and, if the user clicks on it while the file is yet incomplete, it generates a corrupted file error message. Does anyone know how to change the behavior of gs, Konqueror, KDE, dcop, or anything else to ensure the file icon does not appear until the reduction is complete? Thanks - John -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1294107655.27534.13.ca...@denise.theartistscloset.com