View Single Post
Old 01-06-2011, 03:44 PM   #345
nrapallo
GuteBook/Mobi2IMP Creator
nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.nrapallo ought to be getting tired of karma fortunes by now.
 
nrapallo's Avatar
 
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
Tutorial: Using PDFRead to convert (original).pdf to (enhanced/cropped).pdf

Quote:
Originally Posted by ab7vf View Post
nrapallo

maybe 'sam2p' would do what you want .. I've used it to jpg>pdf (slackware/linux)

Jim
Wow, what a great suggestion for FINALLY being able to convert a directory of images (.jpg .gif or .png) into a .pdf using a simple but powerful command line program like sam2p (available for Win32 machines).

However, sam2p doesn't convert more than one image into .pdf (or other formats). No multiple page .pdf can be made using solely sam2p. External programs will have to be used to combine the sam2p .pdf's into one combined.pdf. Pdftk is perfect for that task and is included in the PDFRead/bin

Tutorial: Using PDFRead to convert (original).pdf** to (enhanced/cropped).pdf

To facilitate easy conversion of the intermediate images created by PDFRead into .pdf, I have written a simple batch (sam2pdfread.bat) file that can be placed in the temporary directory (created when an empty file 'debug' is placed in the PDFRead install directory).

To accomplish this (original).pdf to (enhanced/cropped).pdf, do the following:

1. Unzip the attached file and copy the all files into the PDFRead/bin in the default install location (or copy the *.exe programs to a directory in your windows path)

2. Start PDFRead using the .pdf 'In Format" and .html 'Out Format'.

3. When PDFRead is finished, that .html 'Out Format will cause the temporary directory with the enhanced/cropped images to be visible.

4. Copy the 'sam2pdfread.bat' file to that temp dir and double-click it. That's it!

5. The resulting .pdf will have the name of the InputFilename (actually the resulting .html in that temp dir) and should be moved to a more permanent location. The temp dir can then be deleted.

Note: Doubles the memory storage required as each image is converted to a .pdf while retaining the original image.

The 'sam2pdfread.bat' can be edited to tweak the parameters passed to sam2p and/or pdftk. Just experiment what works best for you!

EDIT: 7 Jan 2011
Fixed 'sam2pdfreadt.bat' to correct some sam2p housekeeping issues as well as recompiled pdfread.exe to pad image filenames with leading zeros so that combining *.pdf works properly. This now includes a newer version of pdfread.exe and library.zip so you may want to make backups of the copies in your 'bin' folder before copying these files over.

**Actually, you can use any Input Format (.PDF / .DJVU / .TIFF / .CBZ / .CBR ) in lieu of just .PDF!

Also, while I was recompiling pdfread.exe I fixed a LONG time irk for me, the expansion of small crops into huge images. This time around, any small cropped image will not increase in size more than 10% of the original image. A good tradeoff! All modified files are included in the 'sam2pdfread.rar' below.

Enjoy!
-Nick
Attached Files
File Type: rar sam2pdfread.rar (1,004.7 KB, 2814 views)

Last edited by nrapallo; 02-07-2011 at 09:37 AM. Reason: typo
nrapallo is offline   Reply With Quote