print PDF on windows
How do the Django people handle printing directly on Windows? I remembered about http://timgolden.me.uk/python/win32_how_do_i/print.html, but unfortunately his method for PDFs only print on the default printer. I need the server to produce the PDF, save it (works already) and send it to a specific shared printer on the network. The printer should be determined from a table that holds 'host' - 'printer' pairs e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the http request allows to choose the right printer ('\\PC01\PR01') from that table. Printing should be executed directly when the user has submitted the request. Any solution that pops up the document locally in a PDFReader and where the user has to hit the print button is not viable. Kindly Yours Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
Suppose you have a PDF (generated or downloaded from the internet), are you able to get it printed by scripting? On Aug 25, 4:38 pm, mettwoch wrote: > How do the Django people handle printing directly on Windows? I > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, > but unfortunately his method for PDFs only print on the default > printer. I need the server to produce the PDF, save it (works already) > and send it to a specific shared printer on the network. The printer > should be determined from a table that holds 'host' - 'printer' pairs > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the > http request allows to choose the right printer ('\\PC01\PR01') from > that table. > > Printing should be executed directly when the user has submitted the > request. Any solution that pops up the document locally in a PDFReader > and where the user has to hit the print button is not viable. > > Kindly Yours > Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
Use python to call a PDF reader via the command line - http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manual.pdf (see the Command Line section) Depending on the complexity of your PDFs, I'd recommend using Foxit instead; Adobe Reader on windows isn't the most stable especially when it comes to open many PDFs - you might have to manually manage instances to make sure it doesn't eat up all your memory. Foxit Reader however doesn't render all PDFs perfectly, or at least the same way that Adobe Reader does. YMMV though. 2009/8/26 mettwoch : > > How do the Django people handle printing directly on Windows? I > remembered about http://timgolden.me.uk/python/win32_how_do_i/print.html, > but unfortunately his method for PDFs only print on the default > printer. I need the server to produce the PDF, save it (works already) > and send it to a specific shared printer on the network. The printer > should be determined from a table that holds 'host' - 'printer' pairs > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the > http request allows to choose the right printer ('\\PC01\PR01') from > that table. > > Printing should be executed directly when the user has submitted the > request. Any solution that pops up the document locally in a PDFReader > and where the user has to hit the print button is not viable. > > Kindly Yours > Marc > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
I'm now using Foxit Reader. Thanks for the tip. The following works perfectly in the Django shell and prints the document in attachment.file.path to the specified network printer: p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit Reader.exe', '/t', attachment.file.path, 'SM03\\HPCOMPTOIR0']) The same code works silently in a Apache / mod_wsgi context but does not produce any result on the printer. Do You have any ideas? Marc On Aug 26, 1:46 am, Sam Lai wrote: > Use python to call a PDF reader via the command line - > > http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm > > http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu... > (see the Command Line section) > > Depending on the complexity of your PDFs, I'd recommend using Foxit > instead; Adobe Reader on windows isn't the most stable especially when > it comes to open many PDFs - you might have to manually manage > instances to make sure it doesn't eat up all your memory. Foxit Reader > however doesn't render all PDFs perfectly, or at least the same way > that Adobe Reader does. YMMV though. > > 2009/8/26 mettwoch : > > > > > How do the Django people handle printing directly on Windows? I > > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, > > but unfortunately his method for PDFs only print on the default > > printer. I need the server to produce the PDF, save it (works already) > > and send it to a specific shared printer on the network. The printer > > should be determined from a table that holds 'host' - 'printer' pairs > > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the > > http request allows to choose the right printer ('\\PC01\PR01') from > > that table. > > > Printing should be executed directly when the user has submitted the > > request. Any solution that pops up the document locally in a PDFReader > > and where the user has to hit the print button is not viable. > > > Kindly Yours > > Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
2009/8/27 mettwoch : > > I'm now using Foxit Reader. Thanks for the tip. The following works > perfectly in the Django shell and prints the document in > attachment.file.path to the specified network printer: > > p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit > Reader.exe', > '/t', > attachment.file.path, > 'SM03\\HPCOMPTOIR0']) > > The same code works silently in a Apache / mod_wsgi context but does > not produce any result on the printer. Do You have any ideas? Could be a permissions issue - what user is apache running under? Also, you might want to try enabling the 'allow service to interact with desktop' option to see if that works. If it does, you might have to look at another solution or somehow impersonating another user to do the printing as there are security risks associated with this option. > > Marc > > On Aug 26, 1:46 am, Sam Lai wrote: >> Use python to call a PDF reader via the command line - >> >> http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm >> >> http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu... >> (see the Command Line section) >> >> Depending on the complexity of your PDFs, I'd recommend using Foxit >> instead; Adobe Reader on windows isn't the most stable especially when >> it comes to open many PDFs - you might have to manually manage >> instances to make sure it doesn't eat up all your memory. Foxit Reader >> however doesn't render all PDFs perfectly, or at least the same way >> that Adobe Reader does. YMMV though. >> >> 2009/8/26 mettwoch : >> >> >> >> > How do the Django people handle printing directly on Windows? I >> > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, >> > but unfortunately his method for PDFs only print on the default >> > printer. I need the server to produce the PDF, save it (works already) >> > and send it to a specific shared printer on the network. The printer >> > should be determined from a table that holds 'host' - 'printer' pairs >> > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the >> > http request allows to choose the right printer ('\\PC01\PR01') from >> > that table. >> >> > Printing should be executed directly when the user has submitted the >> > request. Any solution that pops up the document locally in a PDFReader >> > and where the user has to hit the print button is not viable. >> >> > Kindly Yours >> > Marc > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
Apache is running under a system account. A quick test of running Apache under my user account enabled printing indeed. I'll follow your suggestion and create a dedicated user with restricted rights to run Apache under. Thanks so much for your help Marc On Aug 27, 2:42 am, Sam Lai wrote: > 2009/8/27 mettwoch : > > > > > I'm now using Foxit Reader. Thanks for the tip. The following works > > perfectly in the Django shell and prints the document in > > attachment.file.path to the specified network printer: > > > p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit > > Reader.exe', > > '/t', > > attachment.file.path, > > 'SM03\\HPCOMPTOIR0']) > > > The same code works silently in a Apache / mod_wsgi context but does > > not produce any result on the printer. Do You have any ideas? > > Could be a permissions issue - what user is apache running under? > > Also, you might want to try enabling the 'allow service to interact > with desktop' option to see if that works. If it does, you might have > to look at another solution or somehow impersonating another user to > do the printing as there are security risks associated with this > option. > > > > > Marc > > > On Aug 26, 1:46 am, Sam Lai wrote: > >> Use python to call a PDF reader via the command line - > > >>http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm > > >>http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu... > >> (see the Command Line section) > > >> Depending on the complexity of your PDFs, I'd recommend using Foxit > >> instead; Adobe Reader on windows isn't the most stable especially when > >> it comes to open many PDFs - you might have to manually manage > >> instances to make sure it doesn't eat up all your memory. Foxit Reader > >> however doesn't render all PDFs perfectly, or at least the same way > >> that Adobe Reader does. YMMV though. > > >> 2009/8/26 mettwoch : > > >> > How do the Django people handle printing directly on Windows? I > >> > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, > >> > but unfortunately his method for PDFs only print on the default > >> > printer. I need the server to produce the PDF, save it (works already) > >> > and send it to a specific shared printer on the network. The printer > >> > should be determined from a table that holds 'host' - 'printer' pairs > >> > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the > >> > http request allows to choose the right printer ('\\PC01\PR01') from > >> > that table. > > >> > Printing should be executed directly when the user has submitted the > >> > request. Any solution that pops up the document locally in a PDFReader > >> > and where the user has to hit the print button is not viable. > > >> > Kindly Yours > >> > Marc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: print PDF on windows
2009/8/27 mettwoch : > > Apache is running under a system account. A quick test of running > Apache under my user account enabled printing indeed. I'll follow your > suggestion and create a dedicated user with restricted rights to run > Apache under. I'd leave Apache running under the system account - that's how it is by default, and I would think that there are good reasons for it. Try using python to impersonate another user to launch foxit/adobe reader in another user account context, or the easier way is to leverage the 'runas' command to run an app under another user account. http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true > Thanks so much for your help > > Marc > > On Aug 27, 2:42 am, Sam Lai wrote: >> 2009/8/27 mettwoch : >> >> >> >> > I'm now using Foxit Reader. Thanks for the tip. The following works >> > perfectly in the Django shell and prints the document in >> > attachment.file.path to the specified network printer: >> >> > p = Popen (['C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit >> > Reader.exe', >> > '/t', >> > attachment.file.path, >> > 'SM03\\HPCOMPTOIR0']) >> >> > The same code works silently in a Apache / mod_wsgi context but does >> > not produce any result on the printer. Do You have any ideas? >> >> Could be a permissions issue - what user is apache running under? >> >> Also, you might want to try enabling the 'allow service to interact >> with desktop' option to see if that works. If it does, you might have >> to look at another solution or somehow impersonating another user to >> do the printing as there are security risks associated with this >> option. >> >> >> >> > Marc >> >> > On Aug 26, 1:46 am, Sam Lai wrote: >> >> Use python to call a PDF reader via the command line - >> >> >>http://support.adobe.com/devsup/devsup.nsf/docs/52080.htm >> >> >>http://foxit.vo.llnwd.net/o28/pub/foxit/manual/enu/FoxitReader30_Manu... >> >> (see the Command Line section) >> >> >> Depending on the complexity of your PDFs, I'd recommend using Foxit >> >> instead; Adobe Reader on windows isn't the most stable especially when >> >> it comes to open many PDFs - you might have to manually manage >> >> instances to make sure it doesn't eat up all your memory. Foxit Reader >> >> however doesn't render all PDFs perfectly, or at least the same way >> >> that Adobe Reader does. YMMV though. >> >> >> 2009/8/26 mettwoch : >> >> >> > How do the Django people handle printing directly on Windows? I >> >> > remembered abouthttp://timgolden.me.uk/python/win32_how_do_i/print.html, >> >> > but unfortunately his method for PDFs only print on the default >> >> > printer. I need the server to produce the PDF, save it (works already) >> >> > and send it to a specific shared printer on the network. The printer >> >> > should be determined from a table that holds 'host' - 'printer' pairs >> >> > e.g. ('PC01', '\\PC01\PR01'). The host ('PC01') determined from the >> >> > http request allows to choose the right printer ('\\PC01\PR01') from >> >> > that table. >> >> >> > Printing should be executed directly when the user has submitted the >> >> > request. Any solution that pops up the document locally in a PDFReader >> >> > and where the user has to hit the print button is not viable. >> >> >> > Kindly Yours >> >> > Marc > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---