[pywin32-bugs] [ pywin32-Bugs-1481242 ] win32print.WritePrinter() changes CR/LF to LF
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2006-05-04 16:02:10
|
Bugs item #1481242, was opened at 2006-05-03 16:54 Message generated for change (Comment added) made by dnation You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1481242&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32 Group: None Status: Open Resolution: None Priority: 5 Submitted By: DaveNation (dnation) Assigned to: Nobody/Anonymous (nobody) Summary: win32print.WritePrinter() changes CR/LF to LF Initial Comment: I am trying to send files containing raw PCL5 data directly to a Laserjet printer. I am using the following win32print calls : h = OpenPrinter('Laserjet') StartDocPrinter(h,1,('bosdoc',None,'RAW')) WritePrinter(h,buff) EndDocPrinter(h) When directing the data directly to the printer, only the first line is printed. When requesting StartDocPrinter() to spool to a file, the output file is identical to the input file except all CR/LF pairs have been changed to single LF characters. (In PCL5, sending CR resets the x co-ord.) When making the same calls through VB6, the spooled file still contains the CR/LF pair, which makes me think it is the Python interface code that is removing the CR character. ---------------------------------------------------------------------- >Comment By: DaveNation (dnation) Date: 2006-05-04 16:02 Message: Logged In: YES user_id=1515886 Roger Many thanks for your response. It was just as you had summized, the buffer was being loaded from a file not opened in binary mode. I used the file read() method, incorrectly assuming that CR/LF -> LF translation was only done by readline() or readlines(). Once again, thanks for the help it's much appreciated. Dave ---------------------------------------------------------------------- Comment By: Roger Upole (rupole) Date: 2006-05-04 09:34 Message: Logged In: YES user_id=771074 WritePrinter doesn't do any manipulation on the data passed to it. You don't specify where buff comes from, but if you're reading it from a file, make sure it's opened in binary mode. Otherwise, it's treated as text and CR/LF is automatically translated to LF. Roger ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1481242&group_id=78018 |