tutorcruncher / pydf

PDF generation in python using wkhtmltopdf for heroku and docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Isn't rendering

Spawn opened this issue · comments

commented

When image link is presented in html, renderer just ignoring it.
HTML:

<html><style>
         @page {
               size: 9.25in 6.25in;
               margin: 0;
           }
 
        @font-face {
          font-family: "Arial";
          src: url("https://f001.backblazeb2.com/file/inkit-cdn/arial.ttf")
            format("truetype");
        }
        
        @font-face {
          font-family: "Times New Roman";
          src: url("https://f001.backblazeb2.com/file/inkit-cdn/times-new-roman.ttf")
            format("truetype");
        }
        
        @font-face {
          font-family: "Courier New";
          src: url("https://f001.backblazeb2.com/file/inkit-cdn/courier-new.ttf")
            format("truetype");
        }
    </style><body style="user-select:none;margin:0"><div style="width:9.25in;height:6.25in;position:relative"><div><div style="position:absolute;left:0in;top:0in;z-index:5002;right:0;bottom:0;padding:0.1875in;background:url(file:///home/user/Projects/services/pdf-renderer/service/eef55f7f-7bed-44c1-ab2d-0d11c61d4fd7.png) no-repeat center center / cover"><div style="position:relative"></div></div></div><div style="position:absolute;left:0.1875in;top:0.1875in;right:0.1875in;bottom:0.1875in"></div></div></body></html>

Also tried base64 string.

commented

Tried directly from wkhtmltopdf and seeing the same problem. So issue is not in pydf.
@samuelcolvin But if you know what I'm doing wrong, let me know please 🙂
Opened issue for wkhtmltopdf - wkhtmltopdf/wkhtmltopdf#4386

Problem is probably because you have the file on disk eg. file://.

Try putting the file at a real url (or localhost:<port> by running a server locally) and see what happens.

commented

Problem is probably because you have the file on disk eg. file://.

Try putting the file at a real url (or localhost:<port> by running a server locally) and see what happens.

Tried but the same problem.