hello all,
I am stuck with a strange requirement.
I need a library that can help me display a pdf file as a report and
also want a way to print the same pdf file in a platform independent
way.
if that's not possible then I at least need the code for useing some
library for connecting to acrobat reader and giving the print command
on windows and some thing similar on ubuntu linux.
the problem is that I want to display reports in my application. the
user should be able to view the formatted report on screen and at his
choice click the print button on the screen to send it to the printer.
I have reportlab installed and that is sufficient to generate pdf reports.
but I still can't fine the way to display it directly and print it directly.
Please help me.
Krishnakant.
Feb 11 '07
17 8462
On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote:
Grant Edwards wrote:
>On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote:
>>On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote: >I at least need the code for useing some library for >connecti ng to acrobat reader and giving the print command on >windows and some thing similar on ubuntu linux. Just let the registered .PDF viewer do it for you. > os.start('m yfile.pdf') Eh? I don't see os.start() it either 2.5 or 2.44 documentatio n, and it's sure not there in 2.4.3: My bad. os.system()
That doesn't work either:
$ ls -l user.pdf -rw------- 1 grante users 35640 2005-11-21 14:33 user.pdf
$ python Python 2.4.3 (#1, Dec 10 2006, 22:09:09) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright" , "credits" or "license" for more information.
> >>import os >>os.system('us er.pdf')
sh: user.pdf: command not found 32512
> >>>
Works fine on my system. You linux guys just have it hard.
The op said "windows".
The posting to which you replied specified Linux.
I can't answer for ubuntu linux but maybe you can help there?
I don't see how. Pdf files just aren't executable.
--
Grant Edwards grante Yow! FIRST, I'm covering
at you with OLIVE OIL and
visi.com PRUNE WHIP!!
Grant Edwards kirjoitti:
On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote:
>Grant Edwards wrote:
>>On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote: On 2007-02-12, Larry Bates <la*********@we bsafe.comwrote: >>I at least need the code for useing some library for >>connectin g to acrobat reader and giving the print command on >>windows and some thing similar on ubuntu linux. >Just let the registered .PDF viewer do it for you. >> >os.start(' myfile.pdf') Eh? I don't see os.start() it either 2.5 or 2.44 documentati on, and it's sure not there in 2.4.3: My bad. os.system() That doesn't work either:
$ ls -l user.pdf -rw------- 1 grante users 35640 2005-11-21 14:33 user.pdf
$ python Python 2.4.3 (#1, Dec 10 2006, 22:09:09) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright" , "credits" or "license" for more information. >>import os >>os.system('us er.pdf') sh: user.pdf: command not found 32512 >>>
Works fine on my system. You linux guys just have it hard. The op said "windows".
The posting to which you replied specified Linux.
>I can't answer for ubuntu linux but maybe you can help there?
I don't see how. Pdf files just aren't executable.
On Windows, this (where fileName is xyz.PDF, for example):
webbrowser.open (r'file://' + fileName)
starts Acrobat Reader with the document read in. I have no idea why,
because Acrobat Reader sure ain't my browser;)
Maybe someone could try this out on Linux.
Cheers,
Jussi
On Feb 13, 7:44 pm, Jussi Salmela <tiedon_j...@ho tmail.comwrote:
Grant Edwards kirjoitti:
On 2007-02-12, Larry Bates <larry.ba...@we bsafe.comwrote:
Grant Edwards wrote: On 2007-02-12, Larry Bates <larry.ba...@we bsafe.comwrote: On 2007-02-12, Larry Bates <larry.ba...@we bsafe.comwrote: >I at least need the code for useing some library for >connecti ng to acrobat reader and giving the print command on >windows and some thing similar on ubuntu linux. Just let the registered .PDF viewer do it for you.
>>>>os.start('m yfile.pdf') Eh? I don't see os.start() it either 2.5 or 2.44 documentatio n, and it's sure not there in 2.4.3: My bad. os.system() That doesn't work either:
> $ ls -l user.pdf -rw------- 1 grante users 35640 2005-11-21 14:33 user.pdf
> $ python Python 2.4.3 (#1, Dec 10 2006, 22:09:09) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright" , "credits" or "license" for more information. >>import os >>os.system('us er.pdf') sh: user.pdf: command not found 32512
Works fine on my system. You linux guys just have it hard.
The op said "windows".
The posting to which you replied specified Linux.
I can't answer for ubuntu linux but maybe you can help there?
I don't see how. Pdf files just aren't executable.
On Windows, this (where fileName is xyz.PDF, for example):
webbrowser.open (r'file://' + fileName)
starts Acrobat Reader with the document read in. I have no idea why,
because Acrobat Reader sure ain't my browser;)
Maybe someone could try this out on Linux.
Cheers,
Jussi
Works on Ubuntu -- this opens a tab in my browser and then launches
Document Viewer to view the PDF.
peter@astro:~$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright" , "credits" or "license" for more information.
>>import webbrowser webbrowser.op en(r'file:///home/peter/appa.pdf')
On Feb 12, 4:56 pm, Larry Bates <larry.ba...@we bsafe.comwrote:
krishnakant Mane wrote:
hello all,
I am stuck with a strange requirement.
I need a library that can help me display a pdf file as a report and
also want a way to print the same pdf file in a platform independent
way.
if that's not possible then I at least need the code for useing some
library for connecting to acrobat reader and giving the print command
on windows and some thing similar on ubuntu linux.
the problem is that I want to display reports in my application. the
user should be able to view the formatted report on screen and at his
choice click the print button on the screen to send it to the printer.
I have reportlab installed and that is sufficient to generate pdf reports.
but I still can't fine the way to display it directly and print it
directly.
Please help me.
Krishnakant.
Just let the registered .PDF viewer do it for you.
os.start('myfil e.pdf')
Launches whatever is registered as .PDF viewer and user
can then print, save, zoom, etc. on their own.
-Larry
os.startfile('p athToTheFile') should work. Under Library Reference- >
os -Process Management
On 2007-02-11, krishnakant Mane <re**********@g mail.comwrote:
hello all,
I am stuck with a strange requirement.
I need a library that can help me display a pdf file as a report and
also want a way to print the same pdf file in a platform independent
way.
if that's not possible then I at least need the code for useing some
library for connecting to acrobat reader and giving the print command
on windows and some thing similar on ubuntu linux.
the problem is that I want to display reports in my application. the
user should be able to view the formatted report on screen and at his
choice click the print button on the screen to send it to the printer.
I have reportlab installed and that is sufficient to generate pdf reports.
but I still can't fine the way to display it directly and print it directly.
Please help me.
Krishnakant.
I think the best way to handle this under a unix like system is by using
the mailcap module, something like the following:
import mailcap
import os
mc = mailcap.getcaps ()
cmd = mailcap.findmat ch(mc, 'image/pdf' , filename='/tmp/dummy')[0]
os.system(cmd)
--
Antoon Pardon
I'm using Suse Linux which has five program that
will open a pdf file from a shell command line.
Acrobat Reader is one of the five.
A right button click on the file should give a
list of programs that will open a PDF file.
Im using a KDE desktop
Open a shell, add the path to the directory where
the PDF file lives, and on the command line type;
xpdf myfile.pdf ## may also work on a Gnome
## Desktop
or any of these for the KDE desktop;
kpdf myfile.pdf
Kghostview myfile.pdf
konqueror myfile.pdf ## my browser + myfile.
Acrobat Reader is also listed on my system. It
open files as adobe reader using the mouse to
open a pdf file but not from the command line
with an arg, and I haven't spent the time to
figgure out why.
You will have to import os and some combination of
any of the exec.. args, or the popen, spawn, or
system modules.
os.execvep() ## or others like execl, execle ....
os.spawnv(),
os.spawnve(),
os.popen()
hope this give some direction.
jim-on-linux
On Tuesday 13 February 2007 03:44, Jussi Salmela
wrote:
Grant Edwards kirjoitti:
On 2007-02-12, Larry Bates
<la*********@we bsafe.comwrote:
Grant Edwards wrote: On 2007-02-12, Larry Bates
<la*********@we bsafe.comwrote:
>>On 2007-02-12, Larry Bates
<la*********@we bsafe.comwrote:
>>>>>I at least need the code for useing >some library for connecting to acrobat >reader and giving the print command on >windows and some thing similar on >ubuntu linux. > Just let the registered .PDF viewer do it for you. > os.start('m yfile.pdf')
Eh? I don't see os.start() it either 2.5 or 2.44 documentation, and it's sure not there in 2.4.3:
My bad. os.system()
That doesn't work either:
$ ls -l user.pdf -rw------- 1 grante users 35640 2005-11-21 14:33 user.pdf
$ python Python 2.4.3 (#1, Dec 10 2006, 22:09:09) [GCC 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright" , "credits" or "license" for more information.
>>import os >>os.system('us er.pdf')
sh: user.pdf: command not found 32512
Works fine on my system. You linux guys
just have it hard. The op said "windows".
The posting to which you replied specified
Linux.
I can't answer for ubuntu linux but maybe
you can help there?
I don't see how. Pdf files just aren't
executable.
On Windows, this (where fileName is xyz.PDF,
for example): webbrowser.open (r'file://' +
fileName) starts Acrobat Reader with the
document read in. I have no idea why, because
Acrobat Reader sure ain't my browser;)
Maybe someone could try this out on Linux.
Cheers,
Jussi
Dennis Lee Bieber kirjoitti:
On Tue, 13 Feb 2007 08:44:18 GMT, Jussi Salmela
<ti*********@ho tmail.comdeclai med the following in comp.lang.pytho n:
>On Windows, this (where fileName is xyz.PDF, for example): webbrowser.open (r'file://' + fileName) starts Acrobat Reader with the document read in. I have no idea why, because Acrobat Reader sure ain't my browser;)
Most likely Adobe installed the Acrobat plug-in for the browser...
The browser identifies the file as PDF and passes it to the plug-in for
rendering.
I can read PDFs with the browser if I open them in there.
But as I was trying to tell the line above starts the Acrobat Reader EXE
in its own window. The mechanism is probably caused by something I must
have done/installed, but I don't know what.
Anyway: it works just as I want although this may not be the general
behaviour.
(OS: Win XP SP2, Python 2.4.3)
Cheers,
Jussi
For those who care,
the file below should run on a unix/ linux style
system. And "xpdf", amoung others, will run a pdf
file.
import os
def Printpdf():
os.system( 'xpdf form.pdf' )
if __name__ == '__main__' :
Printpdf()
jim-on-linux
On Tue, 13 Feb 2007 08:44:18 GMT, Jussi Salmela
<ti*********@ho tmail.comdeclai med the
following in comp.lang.pytho n:
On Windows, this (where fileName is xyz.PDF,
for example): webbrowser.open (r'file://' +
fileName) starts Acrobat Reader with the
document read in. I have no idea why, because
Acrobat Reader sure ain't my browser;)
Most likely Adobe installed the Acrobat
plug-in for the browser... The browser
identifies the file as PDF and passes it to the
plug-in for rendering.
--
Wulfraed Dennis Lee Bieber KD6MOG wl*****@ix.netc om.com wu******@bestia ria.com HTTP://wlfraed.home.netcom.com/
(Bestiaria Support
Staff: we******@bestia ria.com) HTTP://www.bestiaria.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kay Lee |
last post by:
Hi,
I looked up os module to find out some method to move and copy files in
python,
but os doesn't support such methods.
Is there any way to move & copy files in python?
Thanks in adv.
|
by: Peter Hansen |
last post by:
Greetings.
Im trying to write a program that can be run from the command line.
If I want to search for example after a file with the ending .pdf, I should
be able to write in the command line:
python name of my program / the libary to search and what kind of file it
is example a .pdf file
So if my program name was test.py and the library name was library1 and the
test type i wanted to find was, a .pdf file
I should write python...
|
by: Shufen |
last post by:
Hi,
I'm a newbie that just started to learn python, html and etc. I have
some questions to ask and hope that someone can help me on.
I'm trying to code a python script (with HTML) to get values from a
html form that consists of about 10 checkbox and a textbox where user
have to key in a value to perform a search.
From python tutors, I learned that I have to use the following method:
|
by: News |
last post by:
Hi Everyone,
The attached code creates client connections to websphere queue managers
and then processes an inquiry against them.
The program functions when it gets options from the command line.
It also works when pulling the options from a file.
|
by: JKPeck |
last post by:
I am trying to understand why, with nonwestern strings, I sometimes get
a hex display and sometimes get the string printed as characters.
With my Python locale set to Japanese and with or without a # coding of
cp932 (this is Windows) at the top of the file, I read a list of
Japanese strings into a list, say, catlis.
With this code
for item in catlis:
print item
| |
by: walterbyrd |
last post by:
Lets suppose, I want a listing of what hardware and software is
installed on my
windows box. Can I do that with Python?
|
by: CC |
last post by:
Hi:
I'm building a hex line editor as a first real Python programming exercise.
Yesterday I posted about how to print the hex bytes of a string. There
are two decent options:
ln = '\x00\x01\xFF 456\x0889abcde~'
import sys
for c in ln:
|
by: koutoo |
last post by:
Is it possible to display messages in the python shell? I want to
display error messages based on parameters in my scripts to the
users. Is there another way to display messages other than log
files? Thanks.
Kou
|
by: boblatest |
last post by:
Hello,
it's still me, being unable to load certain modules (for instance,
odbc) in scripts that run though IDLE. I've now written a self-
containing script that illustrates the whole problem:
----------------------------------
import sys, os
# find odbc module in Python distribution tree:
|
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,...
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |