automatical pdf generating

J

Jackie

Hi, all,

There are 50 folders in my hard driver C:
C:\01.c:\02,...,c:\50

There are 4 pictures in each folder:
1.jpg,2.jpg,3.jpg,4.jpg

For each folder, I want to print the 4 pictures into a single-paged
pdf file (letter sized; print horizontally). All together, I want to
get 50 pdf files with names: 01.pdf,02.pdf,...,50.pdf.

Is it possible to use Python to realized the above process? I know
there is a module named "reportlab". Is there any easy command in the
module to do my job?

Thanks

Jackie
 
J

John Nagle

Jackie said:
Hi, all,

There are 50 folders in my hard driver C:
C:\01.c:\02,...,c:\50

There are 4 pictures in each folder:
1.jpg,2.jpg,3.jpg,4.jpg

For each folder, I want to print the 4 pictures into a single-paged
pdf file (letter sized; print horizontally). All together, I want to
get 50 pdf files with names: 01.pdf,02.pdf,...,50.pdf.

Is it possible to use Python to realized the above process? I know
there is a module named "reportlab". Is there any easy command in the
module to do my job?

Thanks

Jackie

Generate HTML for such pages, open them with OpenOffice, and
have OpenOffice generate the PDF file.

John Nagle
 
G

Grant Edwards

V

vasudevram


There are many different ways to do what you want, as the other
replies say.

1. If you're not a programmer, the OpenOffice suggestion is good.

2.1 If you're a programmer, read up on the ReportLab docs shown in a
previous reply by Grant Edwards, and try it out. Equivalently, you
could use Ruby and PDF::Writer. Both ReportLab and PDF::Writer have
support for creating PDFs with images, and both Python and Ruby can
automate the part of iterating over the multiple files and
directories.

2.2 Also you could try another approach - use some scripting language
like Python (or Perl or Ruby) together with one of the free PDF
creation / conversion tools that you can easily find on the Internet
by a Google search (using suitable keywords like "HTML to PDF", "PDF
conversion", etc. Make sure to try out various combinations /
variations of keywords if you don't get a solution at once - this is
fundamental to Web searching.

And ... if you're not a programmer, consider becoming one :)
It's good fun, and will help you do a lot of things ...

Vasudev Ram
http://www.dancingbison.com
http://jugad.livejournal.com
http://sourceforge.net/projects/xtopdf
 
E

Evan Klitzke

Hi, all,

There are 50 folders in my hard driver C:
C:\01.c:\02,...,c:\50

There are 4 pictures in each folder:
1.jpg,2.jpg,3.jpg,4.jpg

For each folder, I want to print the 4 pictures into a single-paged
pdf file (letter sized; print horizontally). All together, I want to
get 50 pdf files with names: 01.pdf,02.pdf,...,50.pdf.

Is it possible to use Python to realized the above process? I know
there is a module named "reportlab". Is there any easy command in the
module to do my job?

It might be easier for you to use a simpler scripting language, like
bash. I realize that you're on Windows, but I've done a lot of neat
things to do PDF transformations in the past with bash and pdftk. In
addition to pdftk, there are a number of other open source tools for
manipulating pdfs (and I believe you can also use ImageMagick and
treat them as images). It might be worthwhile to install Cygwin and
explore this option.
 
N

Nick Craig-Wood

Jackie said:
There are 50 folders in my hard driver C:
C:\01.c:\02,...,c:\50

There are 4 pictures in each folder:
1.jpg,2.jpg,3.jpg,4.jpg

For each folder, I want to print the 4 pictures into a single-paged
pdf file (letter sized; print horizontally). All together, I want to
get 50 pdf files with names: 01.pdf,02.pdf,...,50.pdf.

ImageMagick eats this sort of thing for lunch. It is a set of command
line tools for unix. You can get them with cygwin also

Eg

montage -geometry 1000x1000+100+100 1.jpg 2.jpg 3.jpg 4.jpg 01.pdf

Which resizes each image to a max dimension of 1000 pixels and then
tiles them into a PDF.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top