Mark Misulich wrote:
Hi, a couple of months ago I wrote about the large file sizes that I was getting when I converted a word .doc file to OO odt file, with the intention of later converting it to pdf. They were in the size of megabites. This is a bit of an ongoing saga for me, as this time I made up the newsletter for the organization using Open Office from the start, and then attempted to convert the odt file to pdf in linux. I ended up having to go back to windows in order to get the file sizes to a manageable size, the linux files were too large.
Here is a rundown of what I did. 1. I made up the newsletter using Open Office. The final file size was 198kb. Not too bad, I thought that it was going to work out as I expected the file to be smaller yet when I converted that to a pdf file.
2. I converted the odt file to pdf. The resultant pdf file was 758.8kb. I am shooting for around 200kb, but will send a file up to 300kb. Any larger and it takes too long for the dialup users to download it.
3. I tried to play around with the pdf conversion process by reducing picture quality, and/or reducing the quality of the total pdf document. I produced two other pdf's this way, and believe it or not when I reduced the quality of the document to 50% it actually produced a larger file on my first attempt. That file was 789kb. The second attempt (30% quality) was 750 kb. I decided to save the newsletter odt file in doc format to see how large it would be, before I quit linux for Windows. It came out to 270kb. I was hoping to open it in word in winxp, and then convert it to pdf. But the formatting was so messed up it was easier to start over fresh in Word. But then, they tell me it isn't going to work right when try to save it as a doc file in open office. The new word file displaying the same information (plus an extra couple of pages of text that I forgot on the copy that I produced in OO) as the newsletter produced in odt came out to 220kb.
4. Those linux pdf files were too large to use, so I went back to WinXP and made up the file in Word (220kb). I then converted that to pdf, and got a file size of 270kb. That is useable, and I don't know of any way to make it smaller in Windows unless I start removing some pictures from the newsletter.
As it stands now, I think that I will have to stick with windows for this task unless someone has a brainstorm and thinks of a way to make these linux pdf files smaller.
Mark
I have always had good luck doing it the cups way. setup is a breeze: Add the following print section to your smb.conf. testparm will complain about a global print definition inside the share. Just ignore it's complaint. [pdf-gen] path = /var/tmp guest ok = No printable = Yes comment = PDF Generator print-pdf printing = bsd printcap name = cups #print command = /usr/share/samba/scripts/print-pdf file path win_path recipient IP & print command = /usr/share/samba/scripts/print-pdf "%s" "%H/pdf" "//%L/%u" "%m" "%I" "%J" & ## print command = /home/david/bin/smbprintpdf "%s" "%H/pdf" "//%L/%u" "%m" "%I" "%J" & lpq command = /bin/true create the /usr/share/samba/scripts directory copy the following script there with 0755 permissions Also set /var/spool/samba permissions 0777 Here is the script: #!/bin/bash # samba-print-pdf # This is a script which allows you to set up a virtual printer on samba # which will take the file (generated by a postscript filter on windows) # and turn it into a PDF, informing the user of where it is when it # is done # # (c) Buchan Milne <bgmilne@cae.co.za> 2002 # License: GPLv2 # Changelog # v0.0.6 20030428 # - Allow options passed as env. variables from print command # - Inline and simplify sed (use tr) clean script # - Ensure file arrives in PREFIX even if TEMP is used without provided name # - Changes from Joshua M. Schmidlkofer <joshua@imr-net.com> 20030425 # - Debugging, adjustments, and corrections. # - Stupid sed sanitizing script. [probably horribly inefficient also]. # - Temp file usage cleanup. # v0.0.5 20020723 # - Add support for preset settings # - Allow passing of filename provided by client as final filename # # Arguments: # $1 = file (usually passed with %s from samba) # $2 = unix prefix to where to place the file (~%u should work) # $3 = windows prefix to the same location (//%L/%u should work) # $4 = user/computer to send a notification to (%u or %m) # $5 = IP address of client (%I) # $6 = Name of destination file without extension (%J) # $7 = PDF setting (prepress,print,screen etc) # # If you want to customise any of the following configuration defaults, # you can place them in the file /etc/samba/print-pdf.conf. # If you need to modify anything in this script, please provide me with your # changes, preferably in such a way that the changes are configurable. PS2PDF=ps2pdf13 OPTIONS="-dAutoFilterColorImages=false -sColorImageFilter=FlateEncode" #Values taken from arguments: INPUT=$1 PREFIX="$2" WINBASE=$(echo "$3"|sed -e 's,/,\\\\,g') #NAME=`echo "$6"|sed -e 's/[&/:{}\\\[<>$#@*^!?=|]/-/g;s/\]/-/g'` NAME=`echo "$6"|tr '[:punct:]' '[-*]'` # Source config file if it exists: CONFFILE=/etc/samba/print-pdf.conf [ -e $CONFFILE ] && . $CONFFILE #Values not taken as arguments, could be set via env. vars (?) or config file KEEP_PS=${KEEP_PS=0} PERMS=${PERMS=640} BASEFILE=${BASEFILE=pdf-service} TEMP="${TEMP=$2}" UMASK=${UMASK=006} #Make sure that destination directory exists mkdir -p "$PREFIX" INFILE=$(basename $INPUT) umask $UMASK [ -n "$NAME" ] && TEMP="$PREFIX" #make a temp file to use for the output of the PDF OUTPUT=`mktemp -q $TEMP/$BASEFILE-XXXXXX` if [ $? -ne 0 ]; then echo "$0: Can't create temp file $TEMP/$OUTPUT, exiting..." exit 1 fi if [ -n "$NAME" ]; then FINALOUTPUT="$PREFIX/$NAME" else FINALOUTPUT="$OUTPUT" fi if [ -n "$7" ]; then OPTIONS="$OPTIONS -dPDFSETTINGS=/${7#pdf-}" else OPTIONS="$OPTIONS -dPDFSETTINGS=/default" fi WIN_OUTPUT="$WINBASE\\"`basename "$FINALOUTPUT"` # create the pdf $PS2PDF $OPTIONS "$INPUT" "$OUTPUT.pdf" >/dev/null 2>&1 mv -f "${OUTPUT}.pdf" "${FINALOUTPUT}".pdf # Generate a message to send to the user, and deal with the original file: MESSAGE=$(echo "Your PDF file has been created as $WIN_OUTPUT.pdf\n") # Cleanup if [ $KEEP_PS != 0 ];then mv -f $INPUT "${FINALOUTPUT}".ps MESSAGE=$(echo "$MESSAGE and your postscript file as $WIN_OUTPUT.ps") # Fix permissions on the generated files chmod $PERMS "${FINALOUTPUT}".ps "${FINALOUTPUT}".pdf else rm -f $INPUT # Fix permissions on the generated files chmod $PERMS "${FINALOUTPUT}".pdf fi #Remove empty file from mktemp: rm -f $OUTPUT # Send notification to user echo -e $MESSAGE|smbclient -M $4 -I $5 -U "PDF Generator" >/dev/null 2>&1 **Note, choose a good postscript print driver. I use the HP8500 Color Laserprinter driver that gives great color output with small file sizes. ***Note, the complete .pdf files are placed in ~/pdf -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org