473,586 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.j pg,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 1277
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.j pg,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*********@gm ail.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.co mwrote:
On 2007-06-24, Jackie <jackie.B...@gm ail.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*********@gm ail.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.j pg,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.co m>
Jun 25 '07 #6
Jackie <ja*********@gm ail.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.j pg,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+1 00 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
2037
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 ? Is there a totally free PDF generating lib ? Thanks in advance,
0
1898
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 build release comparisons (I use a script to generate a main page showing all the files that were changed in a build with hyperlinks to side by side...
0
1784
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 dict() print combo2(5)
17
2125
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 in. I think i can work around that (at least a bit) by making a second file that imports the gui generated by wxglade and make classes that extend...
3
10598
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 name as an argument to py_compile.py. But for generating .pyo, I could not find anything. Any clues/help will be greatly appreciated.
3
9429
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 XmlSerializer(oClassType); System.Text.StringBuilder strBuilder = new System.Text.StringBuilder(); System.IO.TextWriter writer = new...
1
2193
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 this happening. Is there anything that could have caused this? Does anyone know of a way to fix it? Thanks. -- Nathan Sokalski...
3
8820
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 "Generating Previews" dialog box while the preview is being generated. I want to suppress this. I've been able to find this from another forum: "The...
0
1848
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 generate the Reports.. I'm having one Stored Procedure(Get_Data) which will combine Two databases & get the data from them.. It is working fine for...
0
1878
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 Particular User Details(ie I wrote Stored Procedure for Getting One Users Details).. Now I Want to Generate the Reports for Different...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.