[mod_python] Server Side Printing

Graham Dumpleton grahamd at dscpl.com.au
Sat Aug 12 07:39:27 EDT 2006

Please keep discussion on the mailing list. I have forwarded your
response back there.

On 12/08/2006, at 9:18 PM, S.R.Pardá wrote:

> Ok, I will try to explain it better.
> I have now in the server a PDF (or HTML) that I can open with eVince.
> How I send that document to a network printer from ModPython's
> interpreted code when client user press PRINT button in one page.
> So server receive a HTTP request for:
> 	http://server/printBill.psp?doc=bill0248.pdf
> So I want to code a printBill.psp page that prints like:
> <%
> PrinterName = "HP-4100"		#Thats the name of the printer for bills
> DocumentToPrint = form('doc')   #The Document the user want to print
> SendToPrint (PrinterName, DocumentToPrint)
> %>
> Now , how I code SendToPrint.
> Do I need to use some library ?
> Can I execute evince from shell indicating some parameter to print  
> on a
> specified printer?
> The principal problem is not be able to print from client if we can't
> select the printer from the server , because user can't select every
> time a printer for every kind of document he prints.
> El sáb, 12-08-2006 a las 20:24 +1000, Graham Dumpleton escribió:
>> On 12/08/2006, at 7:22 PM, S.R.Pardá wrote:
>>> Hi all,
>>> I'm considering solutions to print HTML pages served by some  
>>> Linux OS
>>> with Apache and  Mod_Python.
>>> I am looking a server side approach, that is: I want the server
>>> send the
>>> HTML output when required to one of varios network printers
>>> installed in
>>> the server.
>>> I have not idea about linux printing , I would need an orientation
>>> about
>>> what have to know.
>>> Are any python module for printing?
>>> Must I execute some shell command to print inside python?
>>> Must I generate a PostScript document from the HTML document to  
>>> print
>>> it ?
>>> More details:
>>> Web Clients (Windows probably) will print some documents  
>>> received. But
>>> the documents have diferent formats (size, orientation, duplex  
>>> option)
>>> so it's desiderable the automatic printer/configuration selection
>>> ( that
>>> is: witout a printer selection dialog in IE or Firefox and the  
>>> default
>>> printer isn't valid for all documents)
>>> As I found in client window Javascript it's not capable of select
>>> printers in client side, I have to investigate with VBscript, and
>>> another possibility would be install an ActiveX control to do that
>>> (restricting possible client options).
>>> So I think the server approach, would be better because it  
>>> eliminates
>>> printer management in client, and assures the same HTML render
>>> configuration for all printings, independent of client  
>>> configuration /
>>> browser.
>> Not sure I really understand what you are trying to do, but if your
>> target
>> is a printer, not sure why you would want to try and render to HTML
>> and then print that. Your better option would be target PDF as your
>> display format and then print the PDF file.
>> Suggest you have a look at the following sites:
>>    http://www.openreport.org
>>    http://www.reportlab.org
>>    http://www.reportlab.com
>> With these solutions, one option is to describe documents as RML.  
>> This
>> can be filled out with data from some source and then translated into
>> PDF
>> or HTML. Thus HTML becomes a screen representation but PDF what
>> is used for printing.
>> If you already have the document generation side worked out, and are
>> only really after solution for printing, not sure how Apache and
>> mod_python
>> comes in to it all.
>> Anyway, hope the sites I reference might be of some help.
>> Graham

More information about the Mod_python mailing list