linux-admin.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Odd ghostscript problem (ps to PDF conversion)
@ 2006-07-27 18:48 Jens Knoell
  2006-08-12  2:47 ` Gustavo Guillermo Pérez
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Knoell @ 2006-07-27 18:48 UTC (permalink / raw)
  To: linux-admin

I'm occasionally converting scanned images to PDF files, people seem to 
be able to read/print them easier.

I have two scripts that basically run through the scanned .png files and 
spit out a single PDF in the end. This works for LETTER size, but not 
for LEGAL size, and I don't know why. What happens is this: The scan has 
the proper format (legal size), conversion to pnm and then ps gives me a 
properly legal sized postscript file - but as soon as ghostscript 
processes it, the document gets shifted down by an inch or so, and an 
inch of information gets lost at the end of the page. Why? I wish I 
knew. The script is as follows:

#!/bin/bash
cd ~scanner

for filename in `ls *.png` ; do
  echo -n "Converting $filename to PDF ... "
  pngtopnm $filename | pnmtops -imagewidth=8.5 -imageheight=14 | 
ps2pdf14 -sPAPERSIZE=legal - `echo $filename|cut -d. -f1`.pdf
  rm $filename
  echo "done. Source deleted."
done

echo -n "Concatenating PDF files ... "
gs -dBATCH -dNOPAUSE -dCompatibilityLevel=1.4 -q -sDEVICE=pdfwrite 
-sPAPERSIZE=legal -sOutputFile="/mnt/server/PDF/ScanImage `date +"%a %F 
%H.%M.%S"`.pdf" `ls *.pdf`
echo "done."
echo -n "Cleaning up ... "
rm *.pdf
chmod -R a+rw "/mnt/server/PDF"

echo "done."


Does anyone see something obviously wrong? I don't :(

Jens

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Odd ghostscript problem (ps to PDF conversion)
  2006-07-27 18:48 Odd ghostscript problem (ps to PDF conversion) Jens Knoell
@ 2006-08-12  2:47 ` Gustavo Guillermo Pérez
  0 siblings, 0 replies; 2+ messages in thread
From: Gustavo Guillermo Pérez @ 2006-08-12  2:47 UTC (permalink / raw)
  To: Jens Knoell, linux-admin

El Jueves, 27 de Julio de 2006 13:48, escribió:
> I'm occasionally converting scanned images to PDF files, people seem to
> be able to read/print them easier.
>
> I have two scripts that basically run through the scanned .png files and
> spit out a single PDF in the end. This works for LETTER size, but not
> for LEGAL size, and I don't know why. What happens is this: The scan has
> the proper format (legal size), conversion to pnm and then ps gives me a
> properly legal sized postscript file - but as soon as ghostscript
> processes it, the document gets shifted down by an inch or so, and an
> inch of information gets lost at the end of the page. Why? I wish I
> knew. The script is as follows:
>
> #!/bin/bash
> cd ~scanner
>
> for filename in `ls *.png` ; do
>   echo -n "Converting $filename to PDF ... "
>   pngtopnm $filename | pnmtops -imagewidth=8.5 -imageheight=14 |
> ps2pdf14 -sPAPERSIZE=legal - `echo $filename|cut -d. -f1`.pdf
>   rm $filename
>   echo "done. Source deleted."
> done
>
> echo -n "Concatenating PDF files ... "
> gs -dBATCH -dNOPAUSE -dCompatibilityLevel=1.4 -q -sDEVICE=pdfwrite
> -sPAPERSIZE=legal -sOutputFile="/mnt/server/PDF/ScanImage `date +"%a %F
> %H.%M.%S"`.pdf" `ls *.pdf`
> echo "done."
> echo -n "Cleaning up ... "
> rm *.pdf
> chmod -R a+rw "/mnt/server/PDF"
>
> echo "done."
>
Try to do not specify paper size on ghostcript, in some countries there exist 
a paper size so called "oficio" too like to "legal" that has about 1 inch 
(2cm) of less paper than "legal" we use to increase in our documents the 
footer margin to fit on "officio", I don't know how this should be 
translated.

And why you do not try to use psutils, for doing everything including the 
join, and later just convert ps to pdf.

:)

-- 
Gustavo Guillermo Pérez
Compunauta uLinux
www.compunauta.com
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-12  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-27 18:48 Odd ghostscript problem (ps to PDF conversion) Jens Knoell
2006-08-12  2:47 ` Gustavo Guillermo Pérez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).