473,656 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print a PDF transparently

Hi to all,

I want to print a PDF right from my python app transparently. With
"transparen tly" I mean that no matter what program handles the print
petition, the user shouldn't be noticed about it.

For example, when I want to print a PDF, Adobe Acrobat fires and keep
opened. This is what I don't want to happen (and I thing there are a
lot of people who want this too). So I just want to send the PDF to the
right handler and print it. That's all.

I've seen some things like Adobe's Postscript driver that can read a
PDF, or Ghostscript, but I still don't know how to use it.

Any help for printing a PDF transparently?

Thank you

Daniel

Feb 17 '06 #1
13 3028

Daniel Crespo wrote:
Hi to all,

I want to print a PDF right from my python app transparently. With
"transparen tly" I mean that no matter what program handles the print
petition, the user shouldn't be noticed about it.

For example, when I want to print a PDF, Adobe Acrobat fires and keep
opened. This is what I don't want to happen (and I thing there are a
lot of people who want this too). So I just want to send the PDF to the
right handler and print it. That's all.

I've seen some things like Adobe's Postscript driver that can read a
PDF, or Ghostscript, but I still don't know how to use it.

Any help for printing a PDF transparently?


The only way I was able to find to do it (for free) was to install
GhostScript and GSView. GSView comes with GSPrint.exe, which you can
call with a regular command line to send PDF files to a printer. It
uses GhostScript for you behind the scenes because GhostScript is not
exactly the friendliest program to work with.

Feb 17 '06 #2
In article <11************ **********@o13g 2000cwo.googleg roups.com>,
Daniel Crespo <dc*****@gmail. com> wrote:
Hi to all,

I want to print a PDF right from my python app transparently. With
"transparently " I mean that no matter what program handles the print
petition, the user shouldn't be noticed about it.

For example, when I want to print a PDF, Adobe Acrobat fires and keep
opened. This is what I don't want to happen (and I thing there are a
lot of people who want this too). So I just want to send the PDF to the
right handler and print it. That's all.

I've seen some things like Adobe's Postscript driver that can read a
PDF, or Ghostscript, but I still don't know how to use it.

Any help for printing a PDF transparently?

Feb 17 '06 #3
On 2006-02-17, Daniel Crespo <dc*****@gmail. com> wrote:
I want to print a PDF right from my python app transparently. With
"transparen tly" I mean that no matter what program handles the print
petition, the user shouldn't be noticed about it.
This works for me:

system("lpr whatever.pdf")

Or alternatively,

os.popen("lpr". "w").write(myBi gStringContaini ngPDF)
For example, when I want to print a PDF, Adobe Acrobat fires and keep
opened. This is what I don't want to happen (and I thing there are a
lot of people who want this too). So I just want to send the PDF to the
right handler and print it. That's all.


See above.

--
Grant Edwards grante Yow! hubub, hubub, HUBUB,
at hubub, hubub, hubub, HUBUB,
visi.com hubub, hubub, hubub.
Feb 17 '06 #4
Hi, Thanks for all the answers.

My main purpose is to print on Windows systems (98,2000,XP) and permit
to print pages of 1/3 of a letter height, and make the printer to stop
at that point (in dot matrix printers). When I have a PDF with that
paper size and send it to print from Acrobat, it prints and stops
perfect (in Win98, I have to create a custom form consisting of that
paper size). The problem is that PDF files have to be handled by
external applications, or non-free drivers.

Based on all this, I have been investigating about postscript files. I
realize that printers do handle this language, so I think if I have a
..ps file and send it directly to the printer, it should do the job,
right? (this is certainly a question) If the answer is True, no matter
in what platform I am, if I send the same .ps to the printer, it should
print the same result.

And if all of these is true, then, my problem reduces to generate the
..ps file.

Comments please

Daniel

Feb 17 '06 #5
> Based on all this, I have been investigating about postscript files. I
realize that printers do handle this language, so I think if I have a
.ps file and send it directly to the printer, it should do the job,
right? (this is certainly a question) If the answer is True, no matter
in what platform I am, if I send the same .ps to the printer, it should
print the same result.


No. There are PostScript-Printers out there - but your off-the-shelf InkJet
isn't, and that's the reason why there usually has to be some sort of
driver in-between. Which is either GS or, in case of PDF, the acrobat-* or
any other PDF-printer-emulator.

maybe you can go down the rocky road of automation here, remote-controlling
acrobat reader. But I doubt that it wouldn't at least flash up with its
window for as long as the printing lasts.

Diez
Feb 17 '06 #6
In article <45************ @uni-berlin.de>,
Diez B. Roggisch <de***@nospam.w eb.de> wrote:
Based on all this, I have been investigating about postscript files. I
realize that printers do handle this language, so I think if I have a
.ps file and send it directly to the printer, it should do the job,
right? (this is certainly a question) If the answer is True, no matter
in what platform I am, if I send the same .ps to the printer, it should
print the same result.


No. There are PostScript-Printers out there - but your off-the-shelf InkJet
isn't, and that's the reason why there usually has to be some sort of
driver in-between. Which is either GS or, in case of PDF, the acrobat-* or
any other PDF-printer-emulator.

maybe you can go down the rocky road of automation here, remote-controlling
acrobat reader. But I doubt that it wouldn't at least flash up with its
window for as long as the printing lasts.

Diez


Right. It's possible, barely, to achieve the desired result
with Ghostscript, but it's going to take considerable care in
installation and configuration. We do this sort of thing, but
only on hosts we control; the thought of full-blown "producti-
zation" (let alone the licensing) intimidates me.
Feb 17 '06 #7
On 2/17/2006 9:02 AM, Daniel Crespo wrote:
Hi to all,

I want to print a PDF right from my python app transparently. With
"transparen tly" I mean that no matter what program handles the print
petition, the user shouldn't be noticed about it.

For example, when I want to print a PDF, Adobe Acrobat fires and keep
opened. This is what I don't want to happen (and I thing there are a
lot of people who want this too). So I just want to send the PDF to
the right handler and print it. That's all.

I've seen some things like Adobe's Postscript driver that can read a
PDF, or Ghostscript, but I still don't know how to use it.

Any help for printing a PDF transparently?

Thank you

Daniel

You may find that RedMonEE is a useful piece to your puzzle. I find it
to be stable and quite invaluable.

http://www.is-foehr.de/ RedMon - Redirection Port Monitor EE

Transparent PostScript printing from Windows NT, W2K and XP. Overview
The RedMon EE port monitor redirects a special printer port to a
program. RedMon EE is commonly used with Ghostscript and a
non-PostScript printer to emulate a PostScript printer.

RedMon EE can be used with any program that accepts data on standard
input.

Using RedMon EE you create a redirected printer port. If you connect
a Windows printer driver to the redirected printer port, all data
sent to the redirected port will be forwarded by RedMon to the
standard input of a program. The output of this program can be sent
to different printer port, or the program can generate whatever
output it desires.

A PostScript Windows printer redirected to a RedMon port can shared
on a network. When this printer is configured to use Ghostscript and
a non-PostScript printer, it appears as a PostScript printer to other
network clients.

Feb 17 '06 #8
> Adobe has a Windows PostScript driver for free; but that still
leaves you out... It works as a "printer" but you still have to run the
normal application to print /to/ it -- and that is what you say you
don't want! http://www.adobe.com/support/downloa...jsp?ftpID=1500


Yes, I've seen it, but that's it: another program that I have to
install, which I want to avoid.

I'd be happy if I just do "printer.Print( file.pdf/.ps)" and walá, the
printing just starts (in 98,2000,XP... sounds like a dream), without
having another window opened. If it opens, but then closes, it's
perfect too. I have tried installing Ghostscript, and having a .ps when
I order that file to print, it does the job. The thing here is that I
have to install it.

All this has to be easilly installed (with InnoSetup, for example),
because I have to install it on 70 offices. So I can't leave it to
another installation process. All of these offices have a dot matrix
printers Epson LX-300, which has PostScript level 3 built-in.

Where can I find how to send a .ps directly to the printer?

Daniel

Feb 17 '06 #9

Daniel Crespo wrote:
Yes, I've seen it, but that's it: another program that I have to
install, which I want to avoid.

I'd be happy if I just do "printer.Print( file.pdf/.ps)" and walá, the
printing just starts (in 98,2000,XP... sounds like a dream), without
having another window opened. If it opens, but then closes, it's
perfect too. I have done such thing a few years back, just use the file association
and the "print/printto" action. All you need is to have Acrobat
installed. You can try it by right click on the desktop on a .PDF file
and select print. A modeless dialog would still be visible but would
close itself. This was using ancient Acrobat Reader.

You need to read the WIN32 API(I faintly remembered about Shell
something) that tells you how to do it programmaticall y(I used C).

All this has to be easilly installed (with InnoSetup, for example),
because I have to install it on 70 offices. So I can't leave it to
another installation process. All of these offices have a dot matrix
printers Epson LX-300, which has PostScript level 3 built-in.

Where can I find how to send a .ps directly to the printer?

Again, in the WIN32 API and unfortunately 98 and NT family has
completely different mechanism.

Feb 17 '06 #10

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

Similar topics

12
2393
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__ {}
14
2903
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version: $Revision: 0.0 $
0
1014
by: Jim Hammond | last post by:
I have a client-side component that captures an image and saves it in a file on the client system's hard drive. Although I can return text data from the component and transparently get that text into a server-side object using a hidden field, I don't know how to transparently get an image into a server-side object. Thanks, Jim
4
1268
by: Jim Hammond | last post by:
Is there any way to transparently get an image file from the client machine to the server? I already have a way to transparently generate the file and query for the file name (all done on the client side), but there doesn't seem to be any way to send it to the server after that. For files that are just text, I am able to write their contents to a hidden field, but I can't do that with an image. Thanks, Jim
0
858
by: denz | last post by:
Hi, Basically, in the client proxy that is refering to a web service, i want to be able to switch automatically and transparently, from one URL to another (location of the mirrored service) when the primary or existing web service fails. I have attempted to do this by creating a customized proxy, which performs the desired operation by catching a WebException and then switching the Url from the primary web service to the secondary....
1
2318
by: Steff | last post by:
I am wandering if my code is making sense... I use a lot the print function. Is it weird in this case where I have to display an array ? I thought it would be better to have the entire array in php but now I am not sure if that makes sense. Can you tell me please ? <html> <head>
3
2105
by: James J. Besemer | last post by:
I would like to champion a proposed enhancement to Python. I describe the basic idea below, in order to gage community interest. Right now, it's only an idea, and I'm sure there's room for improvement. And of course it's possible there's some serious "gotcha" I've overlooked. Thus I welcome any and all comments. If there's some agreement that this proposal is worth further consideration then I'll re-submit a formal document in...
0
1191
by: Chris Newby | last post by:
I'm looking for a way to transparently encrypt cookie data using Asp.Net 1.1. Ideally, developers could still do things like: HttpCookie cookie = new HttpCookie( "clearTextKey", "clearTextValue" ); Response.Cookies.Add( cookie ); and ...
6
2380
by: ken | last post by:
is there a way to make a php page only output content that is generated from php statements, such as print, or echo? ie: if I have whitespace (or other text) outside my <?php .... ?block i do not want that to be returned. of course i can do this by making sure my php file starts with <?php and ends with ?and there is no leading or trailing whitespace. but if whitespace does creep into my file then it would be neat if there was some...
0
8382
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8297
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
8816
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...
0
8600
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
6162
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
5629
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1930
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.