Schoeni, Yann wrote: > > I’ve recently start to work with Python. > > > > I’m developing a managment software for a swimming pool, this software > needs to print stuff directly from the website. > > > > I’m using Ajax request and shell exec to call a Python script which > launch the print job. >
Now, do you understand that this will print on the machine where the web server runs, NOT the web browser? Many people, when they click on a "print" button, expect it to print on their local machine, where they clicked. Since you have already had results, I assume you are aware of this. > The script to print an image works fine with a standard printer but, > I’ve to print on a card printer (FARGO-DTC1250^e ). > > > > When I launch a print job from the website, the python script launch > the job on the printer, that’s ok. > > > > The probleme is that I have a substantial quality deterioration ..The > image printed on the card looks bad. > Can you show us an example? Do you see the whole image, approximately scaled, but at poor resolution? Have you tried doing other graphics to see if it really is a pixel count issue? Like, if you draw a rectangle 100x100 pixels, does it really appear to be 1/3"? > I’m sure the problem is about the Python script, I’ve tried to start > the print job directly from Windows, the image quality is perfect. > When you say "start the print job directly from Windows", what do you mean? Do you mean, through some mechanism other than the Python script? > > > I don’t know anymore where to search, eventually when the script draw > the image ? In this part of the code ? > > > > dib = ImageWin.Dib (bmp) > scaled_width, scaled_height = [int (scale * i) fori inbmp.size] > x1 = int ((printer_size[0]- scaled_width) / 2) > y1 = int ((printer_size[1]- scaled_height) / 2) > x2 = x1 + scaled_width > y2 = y1 + scaled_height > dib.draw (hDC.GetHandleOutput (), (x1, y1, x2, y2)) > This is probably relying on the printer's driver to do the image resizing, and many printer drivers don't do a good job. You may need to scale the image using other PIL features and send a correctly-sized bitmap to the printer. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32