Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

Convert html to PDF with wkhtmltopdf

I using wkhtmltopdf tool to convert html to pdf. On my linux computer it outputs everything right with css rules. But after installing the same tool on a Mac, the output does not look the same. The bold tag does not work. The margin to the top does not work and the font size over all looks smaller.

What can be the problem here? The html file is very simple and I think the wkhtmltopdf should behave the same way here independent of platform.

Here is a part of the html file:

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <style>
      td {
        border:solid windowtext 1.0pt;
        background:white;
        padding:0cm 5.4pt 0cm 5.4pt;
        height:19.65pt;
      }
      td.table_header {
        background:#D9D9D9;
      }
      .text_right {
        text-align: right;
      }
      table {
        width: 100%;
        border-collapse:collapse;
        border:none;
        line-height: 80%;
      }
      html {
        background:white;
        font-family: "Arial Unicode MS", sans-serif;
      }
      .header {
        font-size:18.0pt;
        text-align:center;
      }
      .address1 {
        text-align:right;
      }
      .text {
        line-height: 160%;
      }
      .space {
        line-height:80%;
      }
    </style>
  </head>
  <body style="margin:100px 100px;">
question from:https://stackoverflow.com/questions/65860012/convert-html-to-pdf-with-wkhtmltopdf

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...