Printing RTF file under win32

2011-01-21 Thread Mark Carter
I'm using Python 2.6.5 on win32. I would like to print a batch of RTF files on a printer. I don't want to use the win32api.ShellExecute command because that invokes Word, and Word has been configured in a strange way by one of our admins, making it inconvenient to use. What should I do? --

Re: Printing RTF file under win32

2011-01-21 Thread Chris Rebert
On Fri, Jan 21, 2011 at 2:12 AM, Mark Carter alt.mcar...@gmail.com wrote: I'm using Python 2.6.5 on win32. I would like to print a batch of RTF files on a printer. I don't want to use the win32api.ShellExecute command because that invokes Word, and Word has been configured in a strange way by

Re: Printing RTF file under win32

2011-01-21 Thread Michel Claveau - MVP
Hi! Try this line: C:\Program Files\Windows NT\Accessories\wordpad.exe /p D:\data\fil.rtf (change the path if you have a windows 64 bits) @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Jerzy
(128) -- components: Unicode messages: 92196 nosy: Orlowski severity: normal status: open title: Outputting unicode crushes when printing to file on Linux type: crash versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: You have to use an encoding that's not ascii then. -- nosy: +benjamin.peterson resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Jerzy
Jerzy jer...@genesilico.pl added the comment: I know how to make it work. The question is why outputting to file makes it crush when outputting to terminal does not. I have never seen $program file behaving in a different way than $program in any other language Jerzy Orlowski Benjamin

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: When output goes to a terminal, Python can determine its encoding. For a file, it cannot, therefore it refuses to guess. Also, many programs behave differently when used with redirection; namely, all those that use `isatty()` to determine if

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Jerzy
Jerzy jer...@genesilico.pl added the comment: Well, I would suggest using the terminal encoding as default one when redirecting. In my opinion sys.stdin and sys.stdout should always have the terminal encoding Alternatively you could make the function sys.setdefaultencoding() visible to

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Using the terminal encoding for sys.stdout does not work in the general case, as a (background) process may not *have* a controlling terminal (such as a CGI script, a cron job, or a Windows service). That Python recognizes the terminal

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Jerzy
Jerzy jer...@genesilico.pl added the comment: OK, I give up. The problem is that one might test a program on terminal and think that everything is running OK and then spend a reasonable amount of time trying to find the problem later Another approach: couldn't utf8 be set as default encoding

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: If you want to switch to a different language, consider switching to Python 3. There, all strings are Unicode strings, and files opened in text mode always use the locale encoding. -- ___ Python

[issue6832] Outputting unicode crushes when printing to file on Linux

2009-09-03 Thread Jerzy
Jerzy jer...@genesilico.pl added the comment: good point! I will give it a try Jerzy Martin v. Löwis wrote: Martin v. Löwis mar...@v.loewis.de added the comment: If you want to switch to a different language, consider switching to Python 3. There, all strings are Unicode strings, and

Re: Printing to file, how do I do it efficiently?

2006-11-10 Thread Cameron Walsh
Robert Kern wrote: Cameron Walsh wrote: Hi all, I have a numpy.array of 89x512x512 uint8's, set up with code like this: numpy questions are best asked on the numpy list, not here. At first I thought it was a generic python question, since it had more to do with writing array data to file

Printing to file, how do I do it efficiently?

2006-11-09 Thread Cameron Walsh
Hi all, I have a numpy.array of 89x512x512 uint8's, set up with code like this: data=numpy.array([],dtype=uint8) data.resize((89,512,512)) # Data filled in about 4 seconds from 89 image slices snip lots of processing code I first tried writing this data to a binary raw format (for use in a

Re: Printing to file, how do I do it efficiently?

2006-11-09 Thread Robert Kern
Cameron Walsh wrote: Hi all, I have a numpy.array of 89x512x512 uint8's, set up with code like this: numpy questions are best asked on the numpy list, not here. http://www.scipy.org/Mailing_Lists data=numpy.array([],dtype=uint8) data.resize((89,512,512)) You might want to look at using

Re: Printing a file

2006-03-03 Thread David Boddie
Fabian Steiner wrote: David Boddie wrote: In Qt 4, the demos/textedit demo does this with a lot less code. Or are you think of something else? Thank you very much for this hint! Thanks to this example I was able to print out my first pages :) That's good to hear. :-) But some

Re: Printing a file

2006-03-03 Thread Florian Diesch
Fabian Steiner [EMAIL PROTECTED] wrote: I am currently working on an application where the user is able to create new worksheets and to delete existing ones. All of these worksheets have the same structure (-- template?), only some values should be changed. A minimal example would be

Re: Printing a file

2006-03-02 Thread Jeremy Sanders
David Boddie wrote: That's where QPrintDialog comes in: http://doc.trolltech.com/4.1/qprintdialog.html It's also secretly available in Qt 3 via the QPrinter.setup() method: printer = QPrinter() printer.setup() # Now, paint onto the printer as usual. No - that was in my

Re: Printing a file

2006-03-02 Thread David Boddie
Sorry about that. I must have just skipped over the setup() call in your code. If you're creating highly customized content then I think you'll always need to think about getting the pages to the printer in the right order. For rich text documents, there's code that does this in the Qt 3 text

Re: Printing a file

2006-03-02 Thread Fabian Steiner
David Boddie wrote: Sorry about that. I must have just skipped over the setup() call in your code. If you're creating highly customized content then I think you'll always need to think about getting the pages to the printer in the right order. For rich text documents, there's code that does

Re: Printing a file

2006-03-01 Thread Fabian Steiner
Hi! Thank you so far, but now I got stuck again :-/ Jeremy Sanders wrote: QPrinter is easy to use. You just draw to the page the same way as you talk to the screen with a QPainter. prnt = qt.QPrinter() # you can also vary options like colour, doc name, dpi here # display dialog box to

Re: Printing a file

2006-03-01 Thread David Boddie
Fabian Steiner wrote: This is what I have so far: app = QApplication(sys.argv) printer = QPrinter(QPrinter.PrinterResolution) if printer.setup(): printer.setPageSize(printer.A4) painter = QPainter(printer) metrics = QPaintDeviceMetrics(painter.device()) marginHeight =

Printing a file

2006-02-28 Thread Fabian Steiner
Hello! I am currently working on an application where the user is able to create new worksheets and to delete existing ones. All of these worksheets have the same structure (-- template?), only some values should be changed. A minimal example would be something like this: Name: ...

Re: Printing a file

2006-02-28 Thread Jeremy Sanders
Fabian Steiner wrote: Unfortunately I don't know how to realize this, since also some images and different boxes should be printed out. As the whole application is based on QT, QPrinter might be used, but I couldn't find any examples how to use it. QPrinter is easy to use. You just draw to

Re: Printing a file

2006-02-28 Thread David Boddie
Jeremy Sanders wrote: Fabian Steiner wrote: Unfortunately I don't know how to realize this, since also some images and different boxes should be printed out. As the whole application is based on QT, QPrinter might be used, but I couldn't find any examples how to use it. [...] It's