Re: making a pdf file smaller the debian way....

2011-01-26 Thread Celejar
On Sat, 1 Jan 2011 23:36:51 +
Michael Fothergill michael.fotherg...@googlemail.com wrote:

 Dear Debian folks,
 
 I have pdf file that is too big to be emailed around easily.   I tried
 making a zip file out of it but that only made it 1% smaller.  I don't
 have the scanner with me or I could have scanned it at lower
 resolution.

PDFs already utilize some compression, so that's probably why
compressing further won't help all that much.

Celejar
-- 
foffl.sourceforge.net - Feeds OFFLine, an offline RSS/Atom aggregator
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


-- 
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/20110126085919.e7c85235.cele...@gmail.com



Re: making a pdf file smaller the debian way....

2011-01-05 Thread Osamu Aoki
On Sun, Jan 02, 2011 at 09:56:36AM -0600, John Hasler wrote:
 What you have is some sort of image format inside a PDF container.  It
 is probably already compressed, which is why Zip had little effect on
 it.  You need to extract the image, use image software to shrink it, and
 put it back in a PDF container.

I vaguely remember it is likely to be jpeg in PDF container.

Osamu


-- 
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/20110105153000.gb2...@debian.org



Re: making a pdf file smaller the debian way....

2011-01-04 Thread John A. Sullivan III
On Mon, 2011-01-03 at 20:57 -0600, John Hasler wrote:
 John A. Sullivan III writes:
  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?
 
 Have gs write to a hidden temporary file.  Rename it when it's done.
 Arrange to remove the temporary if gs exits abnormally (you need to add
 error-handling anyway).
 -- 
 John Hasler
 
 
Oops - needed to added quotes around the DIR variable in case of spaces
in the directory names.  Here's what we have now:

#!/bin/bash
OFILE=
OK=true
FILES=\$(echo ${1} | sed 's/ \//\ \\//g')\
DIR=$(echo ${FILES} | sed 's/\\([^\]*\)\.*/\1/')
DIR=${DIR%/*}/
EXT=
ret=0
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
FNAME=${OFILE##*/}
DNAME=${OFILE%/*}
kdialog --title Reduce PDF File --msgbox PDF reduction can take
several minutes.\nYou will be notified via popup when the process is
complete.\nThank you. 
eval gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=\${HOME}/tmp/${FNAME}\ ${FILES}
ret=$?
if [ $ret -eq 0 ];then
mv ${HOME}/tmp/${FNAME} ${OFILE}
ret=$?
fi
if [ $ret -ne 0 ];then
rm -f ${HOME}/tmp/${FNAME}
kdialog --title Reduce PDF File --error PDF Reduction of ${OFILE}
failed.
exit 5
fi
kdialog --title Reduce PDF File --msgbox PDF Reduction Completed for:
\n${OFILE}




-- 
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/1294174838.20531.0.ca...@denise.theartistscloset.com



Re: making a pdf file smaller the debian way....

2011-01-03 Thread John A. Sullivan III
On Sun, 2011-01-02 at 03:05 +, 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



Re: making a pdf file smaller the debian way....

2011-01-03 Thread John Hasler
John A. Sullivan III writes:
 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?

Have gs write to a hidden temporary file.  Rename it when it's done.
Arrange to remove the temporary if gs exits abnormally (you need to add
error-handling anyway).
-- 
John Hasler


-- 
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/874o9p9xzp@thumper.dhh.gt.org



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Greg Madden


On Saturday 01 January 2011 05:42:28 pm Michael Fothergill wrote:
 OK,

 Here is what I did here:

 The google search suggestion was to do this:

 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen
 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

 What is peculiar here is that man gs and info gs find the NOPAUSE
 QUIET and BATCH commands or options or whatever they are called but
 the DEVICE=pdfwrite isn't obvious in there at all...  Neither is
 PDFSETTINGS.  Nevertheless someone knew this...

I don't use this stuff often enough to remember the options, each project I do 
I 
have a learning curve.  The package 'ghostscript-doc' is a good source for the 
options. 

snippy

-- 
Peace,

Greg


-- 
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/201101020044.49094.gomadtr...@gci.net



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Sjoerd Hiemstra
Michael Fothergill:
 Doug:
  Just in the last day or two, someone wrote to the list (probably
  this one) that there are a couple of repos you can get to from
  Debian that hold proprietary software, and probably Adobe Acrobat.
 
 I have the debian non free mulltimedia link set up in my apt sources
 file. I did
 
 apt-get update  apt-get install acroread
 
 and successfully installed Acrobat 9 but when I tried it although it
 read the pdf file in fine the google search tip of using the file
 reduction option in the document menu option didn't seem to appear.

You're confusing Adobe Reader with Adobe Acrobat.  The latter, meant
for manipulating pdfs (not just reading them), is only commercially
available.


-- 
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/20110102115438.fd47573e.shiems...@kpnplanet.nl



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Camaleón
On Sun, 02 Jan 2011 02:42:28 +, Michael Fothergill wrote:

 Here is what I did here:
 
 The google search suggestion was to do this:
 
 gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen
 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

(...)

 The info and man write ups are a bit babbitesque/delphic for me.   I
 will look at the ghostscript documentation package I installed and see
 if I can figure out what this set of commands are doing here a bit more
 clearly while being glad that they worked.

When it comes to PDF size, it's all about resolution and images 
compression method. 

What does the above command is outputing a PDF with lower quality and a 
higher compression method for images and you get all that by using -
dPDFSETTINGS=/screen which is a shorcut for a mode that automatically 
reduces the whole dpi of the document (maybe from 1200dpi to 300/600dpi) 
and sets images to 72dpi resulting in a reduced PDF file size.

Other preset modes are -dPDFSETTINGS=/print and -dPDFSETTINGS=/press 
which provides higher quality PDF and so, a bigger file size.

Greetings,

-- 
Camaleón


-- 
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/pan.2011.01.02.11.33...@gmail.com



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Brian
On Sun 02 Jan 2011 at 02:42:28 +, Michael Fothergill wrote:

 So I tried the above command substituting my pdf file as input.pdf and
 creating a suitable name for output.pdf and then hit return in a
 sheepish ignorant kind of way and amazingly enough it worked.  I got a
 pdf file that was much smaller in size but looked fine in evince.

Using the same command my experience with a variety of pdf documents has
been very mixed. One or two are reduced to 10% of the original sizes,
most have no significant reduction and one is three times larger.
 
 The info and man write ups are a bit babbitesque/delphic for me.   I
 will look at the ghostscript documentation package I installed and see
 if I can figure out what this set of commands are doing here a bit
 more clearly while being glad that they worked.

http://pages.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm


-- 
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/20110102133630.gh32...@desktop



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Brian
On Sun 02 Jan 2011 at 11:33:48 +, Camaleón wrote:

 Other preset modes are -dPDFSETTINGS=/print and -dPDFSETTINGS=/press 
 which provides higher quality PDF and so, a bigger file size.

-dPDFSETTINGS=/printer and -dPDFSETTINGS=/prepress with Ghostscript 8.62.


-- 
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/20110102133959.gi32...@desktop



Re: making a pdf file smaller the debian way....

2011-01-02 Thread Camaleón
On Sun, 02 Jan 2011 13:39:59 +, Brian wrote:

 On Sun 02 Jan 2011 at 11:33:48 +, Camaleón wrote:
 
 Other preset modes are -dPDFSETTINGS=/print and
 -dPDFSETTINGS=/press which provides higher quality PDF and so, a
 bigger file size.
 
 -dPDFSETTINGS=/printer and -dPDFSETTINGS=/prepress with Ghostscript
 8.62.

That must be then... I was speaking from memory O:-)

Greetings,

-- 
Camaleón


-- 
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/pan.2011.01.02.14.44...@gmail.com



Re: making a pdf file smaller the debian way....

2011-01-02 Thread John Hasler
What you have is some sort of image format inside a PDF container.  It
is probably already compressed, which is why Zip had little effect on
it.  You need to extract the image, use image software to shrink it, and
put it back in a PDF container.
-- 
John Hasler


-- 
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/87hbdr9u4r@thumper.dhh.gt.org



making a pdf file smaller the debian way....

2011-01-01 Thread Michael Fothergill
Dear Debian folks,

I have pdf file that is too big to be emailed around easily.   I tried
making a zip file out of it but that only made it 1% smaller.  I don't
have the scanner with me or I could have scanned it at lower
resolution.

But e.g. adobe acrobat I think has an option in it somewhere to take a
pdf and reduce it in some way and then output a smaller file.  I
possibly could install acrobat in some non free way that would do that
but I think you might be able to do it in ghostscript from some
limited googling I did.   But maybe there would a better way...


Suggestions welcome.

Michael Fothergill


-- 
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/aanlktiktnwswvjaxjc_vomr4viltusnavo2bc_1jb...@mail.gmail.com



Re: making a pdf file smaller the debian way....

2011-01-01 Thread Greg Madden


On Saturday 01 January 2011 02:36:51 pm Michael Fothergill wrote:
 Dear Debian folks,

 I have pdf file that is too big to be emailed around easily.   I tried
 making a zip file out of it but that only made it 1% smaller.  I don't
 have the scanner with me or I could have scanned it at lower
 resolution.

 But e.g. adobe acrobat I think has an option in it somewhere to take a
 pdf and reduce it in some way and then output a smaller file.  I
 possibly could install acrobat in some non free way that would do that
 but I think you might be able to do it in ghostscript from some
 limited googling I did.   But maybe there would a better way...


 Suggestions welcome.

 Michael Fothergill

One way ... using the cli, install 'poppler-utils'. It contains a bunch of 
tools 
for manipulating pdf files : 'pdftops'  ,

 'Ghostscript' for resizing/rescaling , 'psresize'  and changing back to pdf 
from 'ps', 'pstopdf' 

 http://khuang.blogspot.com/2010/09/cropresize-pdf-page-in-linux.html

-- 
Peace,

Greg


-- 
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/201101011517.06365.gomadtr...@gci.net



Re: making a pdf file smaller the debian way....

2011-01-01 Thread shawn wilson
Converting your scans to text (ocr) might yield you some improvement. Ymmv
depending on the text, images, number of pages, etc. If there are mainly
graphics here, you might look into raster to vector software.

I do not have any recommendations for such software.


Re: making a pdf file smaller the debian way....

2011-01-01 Thread Michael Fothergill
OK,

Here is what I did here:

The google search suggestion was to do this:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen
-dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

What is peculiar here is that man gs and info gs find the NOPAUSE
QUIET and BATCH commands or options or whatever they are called but
the DEVICE=pdfwrite isn't obvious in there at all...  Neither is
PDFSETTINGS.  Nevertheless someone knew this...

So I tried the above command substituting my pdf file as input.pdf and
creating a suitable name for output.pdf and then hit return in a
sheepish ignorant kind of way and amazingly enough it worked.  I got a
pdf file that was much smaller in size but looked fine in evince.

The info and man write ups are a bit babbitesque/delphic for me.   I
will look at the ghostscript documentation package I installed and see
if I can figure out what this set of commands are doing here a bit
more clearly while being glad that they worked.

Thanks for the help.

Regards

Michael Fothergill






On Sun, Jan 2, 2011 at 1:46 AM, shawn wilson ag4ve...@gmail.com wrote:
 Converting your scans to text (ocr) might yield you some improvement. Ymmv
 depending on the text, images, number of pages, etc. If there are mainly
 graphics here, you might look into raster to vector software.

 I do not have any recommendations for such software.


-- 
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/aanlktinfksoc_uvh=m65v8eguoogkwds+o96baspa...@mail.gmail.com



Re: making a pdf file smaller the debian way....

2011-01-01 Thread Doug

On 01/01/2011 06:36 PM, Michael Fothergill wrote:

Dear Debian folks,

I have pdf file that is too big to be emailed around easily.   I tried
making a zip file out of it but that only made it 1% smaller.  I don't
have the scanner with me or I could have scanned it at lower
resolution.

But e.g. adobe acrobat I think has an option in it somewhere to take a
pdf and reduce it in some way and then output a smaller file.  I
possibly could install acrobat in some non free way that would do that
but I think you might be able to do it in ghostscript from some
limited googling I did.   But maybe there would a better way...


Suggestions welcome.

Michael Fothergill


Just in the last day or two, someone wrote to the list (probably this one)
that there are a couple of repos you can get to from Debian that hold
proprietary software, and probably Adobe Acrobat.  Either scan for
that info, or maybe someone will chime in with the proper directions.
(I'm using Acrobat in another distro.  It works fine.)

--doug


--
Blessed are the peacemakers...for they shall be shot at from both sides. --A. 
M. Greeley


--
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/4d1fe7ff.20...@optonline.net



Re: making a pdf file smaller the debian way....

2011-01-01 Thread Michael Fothergill

 Suggestions welcome.

 Michael Fothergill

 Just in the last day or two, someone wrote to the list (probably this one)
 that there are a couple of repos you can get to from Debian that hold
 proprietary software, and probably Adobe Acrobat.  Either scan for
 that info, or maybe someone will chime in with the proper directions.
 (I'm using Acrobat in another distro.  It works fine.)

 --doug


I have the debian non free mulltimedia link set up in my apt sources file.
I did

apt-get update  apt-get install acroread mozilla-acroread (another
google search recommendation)

and successfully installed Acrobat 9 but when I tried it although it
read the pdf file in fine the google search tip of using the file
reduction option in the document menu option didn't seem to appear.
All I got were a sign and security pair of sub menu options under the
document section of the task bar or whatever its called that didn't
give me any other options when I mouse clicked on them.

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.

Regards

Michael Fothergill



 --
 Blessed are the peacemakers...for they shall be shot at from both sides.
 --A. M. Greeley


 --
 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/4d1fe7ff.20...@optonline.net




--
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/aanlktimn8azz13sekae6=oczw4ayz9qkpjvp0hhyj...@mail.gmail.com