Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
432 Lượt xem
<table style="width: 100%;border: 0px solid transparent;" class="o_selected_table">
    <tbody><tr>       
        <td style="text-align: center; vertical-align: top;" class="o_selected_td">
            <img src="{{image_data_uri(object.sudo().test_user.user_id.sign_signature)}}" style="width: 200px; height: auto;border: none !important;">
        </td>     


When I render it in html it's all fine:


When I download the pdf, the img has very strange borders:

Does anybody have an idea how to get rid of them?



Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,


Try the following.

1- Remove borders and outlines completely.


<img src="{{ image_data_uri(object.sudo().test_user.user_id.sign_signature) }}"

     style="width: 200px; height: auto; border: none; outline: none; box-shadow: none; background: transparent;"/>


2- Use table-borderless.


<table style="width: 100%;" class="table table-borderless">

    <tbody><tr>        

        <td style="text-align: center; vertical-align: top;" class="o_selected_td">

            <img src="{{image_data_uri(object.sudo().test_user.user_id.sign_signature)}}" style="width: 200px; height: auto;border: none !important;">

        </td>   



Hope it helps

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Odoo uses an (old) external Python library to generate PDF's while your (modern) browser generates the HTML.

Browser

  • highly evolved, powerful rendering engine that handle CSS, flexbox, and complex layouts with great accuracy and consistency

Python Library

  • more limited rendering engine (dependent on the verion of WebKit installed ) which may not fully support all modern CSS features, especially those related to layout and borders.


Here are a few things to try:

Ảnh đại diện
Huỷ bỏ

Hey Ray
While at it already, got a rough ETA or a potential version of Odoo to look forward to regarding https://github.com/odoo/paper-muncher? v20, v21, ...?

We (not me, the smart folks I work with) have been on a quest for years to find a robust, open-source, and architecturally sound solution for this, but nothing out there quite fits the bill.

What you found is the result of some pioneering co-workers who just wouldn't take no for an answer and ended up with a side project that got entirely out of hand and is a real contender for what we do next.

Our target is Odoo 20.0. It is a huge undertaking whichever way we end up going, and timelines can shift a bit, but that's what we're aiming for. We appreciate you being excited about what's coming next—we are too!

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 8 20
4206
7
thg 2 19
6452
1
thg 8 25
309
1
thg 2 24
3190
1
thg 9 19
7733