473,327 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

automatical pdf generating

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

Jun 24 '07 #1
6 1255
Jackie wrote:
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
Jun 24 '07 #2
Is it possible to use Python to realized the above process?
I know there is a module named "reportlab".
Possible? Yes!

Jun 24 '07 #3
On 2007-06-24, Jackie <ja*********@gmail.comwrote:
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?
Yes.
I know there is a module named "reportlab". Is there any easy
command in the module to do my job?
Yes.

http://www.reportlab.org/rl_toolkit.html
http://www.reportlab.com/docs/userguide.pdf

--
Grant Edwards grante Yow! You mean you don't
at want to watch WRESTLING
visi.com from ATLANTA?
Jun 24 '07 #4
On Jun 24, 10:03 pm, Grant Edwards <gra...@visi.comwrote:
On 2007-06-24, Jackie <jackie.B...@gmail.comwrote:
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?

Yes.
I know there is a module named "reportlab". Is there any easy
command in the module to do my job?

Yes.

http://www.reportlab.org/rl_toolkit..../userguide.pdf

--
Grant Edwards grante Yow! You mean you don't
at want to watch WRESTLING
visi.com from ATLANTA?
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

Jun 24 '07 #5
On 6/24/07, Jackie <ja*********@gmail.comwrote:
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.
--
Evan Klitzke <ev**@yelp.com>
Jun 25 '07 #6
Jackie <ja*********@gmail.comwrote:
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.
--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jun 25 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: paul | last post by:
Hi, I'd like to generate PDF files from my Php website. I've found PDFLib to make it... but i'd like to have your views. It is the best I can find ? Are there any other PDF generating lib ?...
0
by: Dan Gass | last post by:
The difflib.py module and the diff.py tools script in Python 2.4 alpha 3 now support generating side by side (with intra line differences) in HTML format. I have found this useful for performing...
0
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # David Eppstein of the Geometry Junkyard fame gave this elegant # version for returing all possible pairs from a range of n numbers. def combo2(n): return...
17
by: flupke | last post by:
Hi, i create my GUIs mainly via wxGlade. However when you start of to program and want to do some rearranging to the gui, wxglade overwrites your file and you've got to put your own code back...
3
by: skn | last post by:
Hello., Does the python compiler provide an option to generate a .pyo(optimized byte code file) from a .py (source file)? For generating .pyc I know that I only have to pass the source file...
3
by: Raed Sawalha | last post by:
Hello when I serialize an object an error generated using this function public string SerializeObject(object oClassObject,System.Type oClassType) { XmlSerializer oSerializer = new...
1
by: Nathan Sokalski | last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I did anything differently than normal prior to...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
0
by: Aswanth | last post by:
I'm Generating Reports in SSRS-2005.. Previously I got the Data from One Database & Generated Reports.. Now I used to get the Data from Two Different Databases(ie Database-1 & Database-2) & to...
0
by: Aswanth | last post by:
I'm Working with Asp.Net with C#.. & I'm Generating Reports in SSRS-2005.. Till Now I'm Generating Reports in SSRS-2005 with Stored Procedure.. in Which I'm Generating Reports for One...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.