[python-win32] Question about Python script
mc@mclaveau
mc at mclaveau.com
Sat Oct 7 03:52:58 EDT 2017
Le 06/10/2017 à 12:51, Schoeni, Yann a écrit :
>
> Hello,
>
> 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.
>
> 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.
>
> I first thought it was because of the DPI which was incorrectly
> configurated but I’ve type :
>
> printer_dpi = hDC.GetDeviceCaps (LOGPIXELSX), hDC.GetDeviceCaps
> (LOGPIXELSY)
>
> And I get (300, 300) which is correct.
>
> 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.
>
> 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))
>
> I hope you’ll have the time to help me.
>
> Best wishes J
>
> **
>
> *Yann Schoeni*
>
> *Municipalité de Moutier *
>
> Apprenti informaticien
>
> Tél. +41 (0)32 494 11 69
>
> Mob. +41 (0)79 827 30 86
>
> E-mail yann.schoeni at moutier.ch <mailto:yann.schoeni at moutier.ch>
>
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
Bonjour !
Ce qui me gène un peu, ce sont les SCALE pour impression. Surtout que la
définition (résolution) de l'image peut alors changer.
Je vous suggère d'utiliser une imprimante PDF (comme doPDF ou
PDFcreator) pour mettre au point le script, puis de changer d'imprimante
lorsque tout fonctionnera correctement.
Une autre idée de solution, c'est de créer un PDF (par exemple avec
ReportLAB PDF toolkit), puis de l'imprimer à la volée. Il est aussi
possible de piloter Word.
@-salutations
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20171007/e6cc3bfc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sign-styloplume.GIF
Type: image/gif
Size: 9129 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-win32/attachments/20171007/e6cc3bfc/attachment-0001.gif>
More information about the python-win32
mailing list