473,698 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PDF Printing support from Python

Hi all... Is there a way to print a PDF file directly from Python
without having Acrobat installed? I know about ReportLab. It's a python
module that lets you create almost any PDF document, but I still don't
know if it supports printing, so I'm looking for a Python module that
could do it. I want to print a PDF file just like if I were doing it
from Acrobat.

Daniel.

Jul 19 '05 #1
19 3203
On 2005-04-22, dcrespo <dc*****@gmail. com> wrote:
Hi all... Is there a way to print a PDF file directly from
Python without having Acrobat installed?
Assuming your printing system was setup competently:

os.system("lpr %s" % filename)
I know about ReportLab. It's a python module that lets you
create almost any PDF document, but I still don't know if it
supports printing, so I'm looking for a Python module that
could do it. I want to print a PDF file just like if I were
doing it from Acrobat.


Not sure what you mean by "just like if I were doing it from
Acrobat".

--
Grant Edwards grante Yow! I have seen these
at EGG EXTENDERS in my
visi.com Supermarket... I have read
theINSTRUCTIONS ...
Jul 19 '05 #2
Hi Grant Edwards...

Your solution requires a previous installation of Acrobat. Internally,
the OS is sending the pdf file to the Acrobat PDF Driver and then it is
sent to the printer. So you have to have Acrobat installed. Don't you?
I want to avoid it installing a module that could do it (maybe I'm
dreaming:( ). If there's no solution, then I will be very sad :-S

This is what exactly I need to do:
Generate an invoice of 216cm width and 93cm height (1/3 of the height
of a letter paper size), and print it respecting these dimensions. So,
when I print this page on a dot matrix printer, it stops at those 93cm
of height for continuous printing.

What I tried:
I created a pdf file manually with these dimensions, and right-click on
the pdf file, and selected "print". It just work under Windows XP with
Acrobat Reader 7.0, but I want to do it from a Win98 as well.
Unfortunately, there's no Acrobat version under Win98 (the maximun is
5.1) that supports this kind of printing (what I had seen until now).
It prints, but the all paper at letter size :(

Any help? Any other tools? Any one like Cristal Report but for Python?
I heard that wxPython supports some kind of reporting, but I don't know
it. Anyone knows?

Daniel

Jul 19 '05 #3
"dcrespo" <dc*****@gmail. com> writes:
Hi Grant Edwards...

Your solution requires a previous installation of Acrobat. Internally,
the OS is sending the pdf file to the Acrobat PDF Driver and then it is
sent to the printer. So you have to have Acrobat installed. Don't you?
I want to avoid it installing a module that could do it (maybe I'm
dreaming:( ). If there's no solution, then I will be very sad :-S

This is what exactly I need to do:
Generate an invoice of 216cm width and 93cm height (1/3 of the height
of a letter paper size), and print it respecting these dimensions. So,
when I print this page on a dot matrix printer, it stops at those 93cm
of height for continuous printing.

What I tried:
I created a pdf file manually with these dimensions, and right-click on
the pdf file, and selected "print". It just work under Windows XP with
Acrobat Reader 7.0, but I want to do it from a Win98 as well.
Unfortunately, there's no Acrobat version under Win98 (the maximun is
5.1) that supports this kind of printing (what I had seen until now).
It prints, but the all paper at letter size :(

Any help? Any other tools? Any one like Cristal Report but for Python?
I heard that wxPython supports some kind of reporting, but I don't know
it. Anyone knows?

Daniel

When you say "OS", are you talking MS Windows by any chance? On *NIX
(e.g., CUPS+ghostview+ foomatic), PDF printing is not via Adobe code.

You could also consider pdf2ps, pdftops, and XPDF.
--
ha************@ boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
Jul 19 '05 #4
On 2005-04-22, dcrespo <dc*****@gmail. com> wrote:
Your solution requires a previous installation of Acrobat.
Probably not. Most printing systems I'm familiar with use
ghostscript to render PDF into either postscript (the case on
my machines at home) or whatever raster format the printer
desires (the case at my office).
Internally, the OS is sending the pdf file to the Acrobat PDF
Driver and then it is sent to the printer.
Nope. It's usnig the foomatic print filters which in turn use
ghostscript to render PDF.
So you have to have Acrobat installed. Don't you?
No you just need a good printing system. CUPS + foomatic works
great for me. It knows what to do with postcript, text, PDF,
dvi, and a whole boatload of other fileformats that I don't
ever use.
I want to avoid it installing a module that could do it (maybe
I'm dreaming:( ). If there's no solution, then I will be very
sad :-S

This is what exactly I need to do: Generate an invoice of
216cm width and 93cm height (1/3 of the height of a letter
paper size), and print it respecting these dimensions. So,
when I print this page on a dot matrix printer, it stops at
those 93cm of height for continuous printing.

What I tried: I created a pdf file manually with these
dimensions, and right-click on the pdf file, and selected
"print". It just work under Windows XP with Acrobat Reader
7.0, but I want to do it from a Win98 as well.


Ah. You're using Windows. I didn't know that. I've no clue
what to do under Windows.

--
Grant Edwards grante Yow! .. someone in DAYTON,
at Ohio is selling USED
visi.com CARPETS to a SERBO-CROATIAN
Jul 19 '05 #5
Grant's example is not for Windows, Daniel, but it does illustrate a
certain principle: if you have a printer driver that understands PDF,
or some other external software such as Acrobat Reader that understands
PDF, then printing the PDF is as simple as telling the OS to just print
the file.

If you are looking for some software that acts as a PDF-understanding
interpreter, that must run under Windows 98, I don't know of any
written in Python. However, you might want to research some of the
available non-Python utilities. Ghostscript, for example, is available
at http://www.cs.wisc.edu/~ghost/ and has a version for Win32. You
could easily use Python to drive GhostScript.

Does that fit your needs?

---Peter

Jul 19 '05 #6
"dcrespo" <dc*****@gmail. com> writes:
Hi Grant Edwards...

Your solution requires a previous installation of Acrobat. Internally,
the OS is sending the pdf file to the Acrobat PDF Driver and then it is
sent to the printer. So you have to have Acrobat installed. Don't you?
I want to avoid it installing a module that could do it (maybe I'm
dreaming:( ). If there's no solution, then I will be very sad :-S [...] Acrobat Reader 7.0, but I want to do it from a Win98 as well.
Unfortunately, there's no Acrobat version under Win98 (the maximun is
5.1) that supports this kind of printing (what I had seen until now).
It prints, but the all paper at letter size :(
That doesn't sound like a fundamental problem with AR 5.1 to me --
sounds like you just need to ask it more nicely ;-)

Have you tried the latest version of APFL ghostscript, though (8.51)?

Any help? Any other tools? Any one like Cristal Report but for Python?
I heard that wxPython supports some kind of reporting, but I don't know
it. Anyone knows?


First, decide what qualities you need from your output format, then
decide which format you want, and how to generate and print it. Is it
important that you have one, other, or both of bitmap or vector
output, for example?
John
Jul 19 '05 #7
Thanks a lot... I'm attemping to give it a try :)

Jul 19 '05 #8
> That doesn't sound like a fundamental problem with AR 5.1 to me --
sounds like you just need to ask it more nicely ;-)

AR 7.0 has the function to print exactly the page size you set. AR 5.1
doesn't. Instead, it print it on an existing page size like letter, but
without changing the relative layout of the each line of text respect
each other.

Daniel

Jul 19 '05 #9
>> Your solution requires a previous installation of Acrobat.
Probably not. Most printing systems I'm familiar with use
ghostscript to render PDF into either postscript (the case on
my machines at home) or whatever raster format the printer
desires (the case at my office).
Acrobat (windows) and Ghostscript are PDF drivers.
Internally, the OS is sending the pdf file to the Acrobat PDF
Driver and then it is sent to the printer.

Nope. It's usnig the foomatic print filters which in turn use
ghostscript to render PDF.
What I mean is that the pdf file is sent to a pdf driver (some program
to interpret it)... In your case is ghostscript, and in my case is
Acrobat.
No you just need a good printing system. CUPS + foomatic works
great for me. It knows what to do with postcript, text, PDF,
dvi, and a whole boatload of other fileformats that I don't
ever use.


CUPS + foomatic are the whole megadriver... So it's just a manner of
saying PDF Driver for my study case.

Really thanks for all the information :) I didn't know about
Ghostscript.

Daniel

Jul 19 '05 #10

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

Similar topics

5
3328
by: Donnal Walter | last post by:
We want to be able to print HTML or PDF files to a given printer from Python in a kind of batch mode (without opening a preview window or printer dialog for each file). The printer is on a network, but for testing purposes I have connected it to my desktop via LPT1. I can easily print a text file from Python using: os.system("copy some.txt LPT1") And as expected, using this function with "some.html" simply prints the html source. (But...
2
2055
by: David Isaac | last post by:
I'd like to try personal financial management using Python. I just found PyCheckbook, but it does not support check printing. Is there a Python check printing application kicking around? Thanks, Alan Isaac
8
2423
by: David Isaac | last post by:
"Alan Isaac" <aisaac0@verizon.net> wrote in message news:_A34e.2207$1r6.248@trnddc02... > I'd like to try personal financial management using Python. > I just found PyCheckbook, but it does not support check printing. > Is there a Python check printing application kicking around? OK, I'll assume silence means "no", so new question: What is the current best practice for cross platform printing of PostScript files from Python?
10
4967
by: Mario | last post by:
Hello all, I'm trying hard to make possible to print some simple text from python to the default printer using wxPython, after days of internet searches I found this page: http://wiki.wxpython.org/index.cgi/Printing but is impossible to use this script even if I do exactly as said there. I think the script is buggy or I am not able to use it, even if seems very simple to use... Anyone can give me an hint on how to easily and simply print...
12
6369
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
7
2379
by: Burhan | last post by:
Hello Group: I am in the planning stages of an application that will be accessed over the web, and one of the ideas is to print a barcode that is generated when the user creates a record. The application is to track paperwork/items and uses barcodes to easily identify which paper/item belongs to which record. Is there an easy way to generate barcodes using Python -- considering the application will be printing to a printer at the...
8
5891
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web clients (Internet Explorer). My flash content was originally brought in via the “flash satay” method, but I have since used some server-side magic do deliver one <objecttag
18
11295
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing classes, for each of the checked rows in the GridView. This works fine in the Visual Studio 2005 development environment on localhost. But, when I move the page to the web server, I get the error "Settings to access printer...
7
1912
by: SpaceMarine | last post by:
hello, i have an application that builds up a large "incident report" for a law enforcement agency. In the end this is represented in a large object containing many properties and collections related to the incident. we now need a way to produce a PDF for printing. what are common ways to do this?
0
8610
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8902
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.