Community mailing list archives

community@mail.odoo.com

Re: Wkhtmltpdf measures problems

by
Yassine TEIMI
- 09/07/2016 08:42:52
Thanks Gustavo, I'll try this out.

Regards.

2016-09-07 13:07 GMT+01:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

Hi Yassine,

 

I think it should be:

command_args.extend(['--disable-smart_shrinking'])

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: woensdag 7 september 2016 11:48


Aan: Community <community@mail.odoo.com>
Onderwerp: Re: Wkhtmltpdf measures problems

 

HI Brecht, Hi Gustavo, thanks for your answers,

So in _build_wkhtmltopdf_args method I added :

command_args.extend(['--disable-smart_shrinking', 'True'])

 

But after that, the report does not loead correctly.

did the same with --zoom option :


command_args.extend(['--zoom', '1.2'])

 

and it worked fine, but I'll try to do it in a clean way, just the time I learn using docker.

@Gustavo : Can you show me which value to assign to --disable-smart-shrinking option ?

Thanks a lot.

 

2016-08-31 15:48 GMT+01:00 Gustavo Marino <gamarino@numaes.com>:

In odoo/addons/report/models/report.py, between lines 511 and 533 the function _build_wkhtmltopdf_args builds the command line to be used to invoke wkhtmltopdf.

 

If you add the switch --disable-smart-shrinking you will get absolute sizing. If no parameter is given, the resizing is automatic

 

Be carefull. Old reports will be resized!

 

Best regards


Gustavo Adrian Marino

 

Mobile:  +54 911 5498 2515

Email: gamarino@numaes.com

Skype: gustavo.adrian.marino

 

Descripción: Numa Logo V 1-0

 

 

2016-08-31 7:25 GMT-03:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

If you want to do it quick and dirty:

 

 

Find this in addons\report\models\report.py

wkhtmltopdf = [_get_wkhtmltopdf_bin()] + command_args + local_command_args

 

In wkhtmltopdf you have a zoom command arg, use this to set it correct on the other server (hardcoded or as a parameter on reports…)

Something like this extremely dirty code:

wkhtmltopdf = [_get_wkhtmltopdf_bin()] + command_args + local_command_args + ‘ --zoom 1.2’

 

You can set a print statement like this:

Print(wkhtmltopdf)

After the previous statement to look for differences in the statement on the debian and the ubuntu (to not miss the obvious) (and if you can’t debug on the server)

 

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: woensdag 31 augustus 2016 11:53


Aan: Community <community@mail.odoo.com>
Onderwerp: Re: Wkhtmltpdf measures problems

 

Hi Brecht,

If you spent 10 years trying to get it perfect from scratch, i'll be crazy if I try to do so now, so could you please tell me how can I use the scalling solution vie the command line ?

Regards.

 

2016-08-31 10:03 GMT+01:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

Hi Yassine,

 

I changed to Docker because i couldn’t get it perfect J

I’m already working on Linux for over 10 years and even build my own system from scratch (a long time ago) but i couldn’t get it perfect so, good luck or try the scaling solution (it’s a parameter on wkhtmltopdf in the command line)

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: woensdag 31 augustus 2016 10:43


Aan: Community <community@mail.odoo.com>
Onderwerp: Re: Wkhtmltpdf measures problems

 

HI Brecht,

For the moment, i'll try to mimic the environment, i know this is not a best practice, but I need to unlock the situation, I'll use docker after (it's really a good practice).

I want to ask you how can I detect all the librairies I need to mimic ? maybe it's not only the font librairies don't you ?

Regards.

 

2016-08-31 9:17 GMT+01:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

Hello Yassine,

 

You could try to control them by installing the same font package and try to mimic the environment but if ubuntu (or debian) updates a package it could break it all.  My suggestion is to eliminate this by standardizing your environment.

You could do this by installing Ubuntu Server edition on everything but most people like a gui for development so that wouldn’t be a good choice so Docker containers are (for me) the best choice.

 

It will save you countless problems and is worth learning.

 

It means you can take your installation and install it on any environment (in the cloud, on premises, on your laptop, on windows) and it will always act the same predictable way.

 

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: woensdag 31 augustus 2016 10:08


Aan: Community <community@mail.odoo.com>
Onderwerp: Re: Wkhtmltpdf measures problems

 

Hello Brecht,

So these calculated parameters change from ubuntu to debian ? how to control them ? is it by modifying the method in the module report, or by using docker ?

 

2016-08-31 8:47 GMT+01:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

Hello Yassine,

 

The scaling, fonts, … are calculated on parameters of the underlying system so even with the same version of wkhtmltopdf you end up with different parameters if you aren’t in a controlled environment.

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: woensdag 31 augustus 2016 9:38
Aan: Community <
community@mail.odoo.com>
Onderwerp: Re: Wkhtmltpdf measures problems

 

Dears, thanks for your answers,

@Brecht Verhaeghe :

Here is my local machine caracteristics :

Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:    precise

 

Here is my poduction server caracteristics :

Distributor ID:    Debian
Description:    Debian GNU/Linux 8.0 (jessie)
Release:    8.0
Codename:    jessie

 

Both have same wkhtmltopdf version :

wkhtmltopdf 0.12.2.1 (with patched qt)

 

It's ubuntu vs debian.

@ Omprakash Maury : Thanks for the tutorial.

@ Gustavo Marino : Can you point me the code part (method) using this scale parameter ? did you this solution, and resized all standard reports ? maybe we can set a boolean and apply this scale parameter only for standard reports.

Regards.

 

 

2016-08-30 18:43 GMT+01:00 Gustavo Marino <gamarino@numaes.com>:

With Odoo settings, wkhtmltopdf uses an adaptative scale to render the its output.

It is a parameter on wkhtmltopdf command execution call, in module report, hard coded in python source code.

 

You can choose to remove this parameter. After that, measures will be absolut, and thus repetible, but almost all standard reports should be resized (using a different font size) and should be adjusted

 

 

Regards


Gustavo Adrian Marino

 

Mobile:  +54 911 5498 2515

Email: gamarino@numaes.com

Skype: gustavo.adrian.marino

 

Descripción: Numa Logo V 1-0

 

 

2016-08-30 14:22 GMT-03:00 Brecht Verhaeghe <brechtverhaeghe@kranksoft.be>:

Hello,

 

Are both servers the same or is it desktop v.s. server?

I used to have this problem when moving from production to server environments. Some fonts that i couldn’t find in the server environment or some libs that i forgot to pip install…

I started using Docker containers and now all my deployment problems are gone.

 

I develop inside a debugging container. This one creates a thin debugging layer on top of my odoo container.

If i need an extra library, i add it to the docker file and rebuild everything.

 

Met vriendelijke groeten,

Brecht Verhaeghe

Kranksoft GCV

brechtverhaeghe@kranksoft.be
tel 0497/46 07 27

 

Van: Yassine Teimi [mailto:yteimi01@gmail.com]
Verzonden: dinsdag 30 augustus 2016 18:13
Aan: Community <
community@mail.odoo.com>
Onderwerp: Wkhtmltpdf measures problems

 

Dears,

I've created a report with css using fixed measurments (not relative ones), so the purpose of this report is to create adress cards, used on the post office.

The problem is, when I fix adress cards height and width with pixels or centimeters, milimeters, it's considered differently from an odoo instance to another, knowing that the two have the same wkhtmltopdf version. It's like the one centimeter for wkhtmltopdf, is not the real one, that we know.

Is there anyone having the same problem ?

I'm using the more stable version : 0.12.1 on ubuntu 12.04 LTS 64 bit.

Thanks.

 

--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

 

Cordialement

 

Yassine TEIMI

 

Consultant & Odoo Project Manager

TEL : +212 6-87 71 41 18

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--

Cordialement

Yassine TEIMI

Consultant & Odoo Project Manager
TEL : +212 6-87 71 41 18