
出于某种原因,输出pdf很小.
我的pdfkit选项字典是 –
options = { 'quIEt': '','page-size': 'A4','margin-top': '0.75in','margin-right': '0.75in','margin-bottom': '0.75in','margin-left': '0.75in','disable-smart-shrinking': '' } 输出文件是here
HTML代码是 –
<!DOCTYPE HTML><HTML><head> <Meta charset="utf-8"> <Meta name="pdfkit-orIEntation" content="Portrait"/> <Meta http-equiv="X-UA-Compatible" content="IE=edge"> <Meta name="vIEwport" content="wIDth=device-wIDth,initial-scale=1"> <!-- The above 3 Meta Tags *must* come first in the head; any other head content must come *after* these Tags --> <Title>dribble</Title> <!-- bootstrap --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/CSS/bootstrap.min.CSS"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/CSS/bootstrap-theme.min.CSS"> <!-- Google Font --> <link href="https://Fonts.GoogleAPIs.com/CSS?family=Open+Sans:300,400,700,800" rel="stylesheet"> <!-- Custom Font --> <style> body { Font-family: 'Open Sans',sans-serif; } p,a { color: #002f54; } .nav { background: #002f54; color: #FFFFFF; border-radius: 5px; } .ico { padding-right: 5px; top: 3px; } .nav > li p { text-align: center; Font-size: 36px; Font-weight: 800; } .right-align { float: right; } .pad-mar { Font-size: 18px; padding-top: 10px; padding-bottom: 10px; margin-left: 30px !important; margin-right: 30px; } .pad-mar-mIDdle { Font-size: 18px; padding-top: 78px; padding-bottom: 25px; margin-left: 30px !important; margin-right: 30px; } .pad-mar-bottom { Font-size: 18px; padding-top: 10px; padding-bottom: 90px; margin-left: 30px !important; margin-right: 30px; } .pad-mar-footer { padding-top: 20px; margin-left: 30px !important; margin-right: 30px; } .bor-bottom { border-bottom: 2px solID #ccc; } .no-pad { padding-left: 0; } .section { margin-top: 20px; margin-bottom: 20px; } .bold { Font-weight: 700; color: #002f54; } .small { Font-size: 14px; } .bolder { color: #002f54; Font-weight: 800; Font-size: 22px; } .normal { color: #002f54; Font-weight: 700; } .smaller { Font-size: 14px; Font-weight: 700; } h3 .bold { margin-top: 0; } .neg-mar { margin-top: -25px; } .cus-img { max-wIDth: 85px; margin-bottom: 10px; } .nav-stacked.mob > li { Font-size: 16px; margin-left: 0px !important; margin-right: 0px; margin-bottom: 10px; padding-top: 5px; border: 1px solID #EB6C6D; border-radius: 5px; Font-weight: 300; text-align: center; color: #EB6C6D; } .nav-stacked.mob > li p { color: #002f54; } .nav.mob { background: #FFFFFF; } .pad-mar-bottom.mob { margin-left: 0px !important; padding-bottom: 10px; } .pad-mar-footer.mob { margin-left: 0px !important; text-align: center; padding-top: 10px; } .l-mar { margin-left: 40px; } .titl { color: #EB6C6D; Font-size: 16px; } .bot-mar { margin-bottom: 20px; } .container { max-wIDth: 575px; } </style> <!-- HTML5 shim and Respond.Js for ie8 support of HTML5 elements and media querIEs --> <!-- WARNING: Respond.Js doesn't work if you vIEw the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/HTML5shiv/3.7.3/HTML5shiv.min.Js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.Js"></script> <![endif]--></head><body><section > <div > <div > <div > <img src="https://API.figo.me/assets/images/accounts/north_channel_bank_144.png" /> <p> Commerzbank Service-BZ</p> <p>First line</p> </div> <div > <div > <h3 >First line</h3> <p >First line</p> <p >First line</p> </div> </div> </div> <div > <div > <ul > <li><span ></span>From<p>Rewe GmbH</p></li> <li><span ></span>Amount<p>,10 USD</p></li> <li><span ></span>Payment Date<p>Nov 5,2017</p> </li> </ul> </div> </div> <div > <p ><span ></span>Payment Reference</p> <div > <p >Hello Ennio,</p> <p >You sent a payment of <span >.00 USD</span> to dribble. (<a href="mailto:paypal@dribble.com">paypal@dribble.com</a>)</p> <div > <p >It may take a few moments for this transaction to appear in your account.</p> </div> </div> </div> <footer> <div > <a href="#">This document was automatically generated by Koryo</a> </div> </footer> </div><!-- Container --></section><!-- jquery (necessary for bootstrap's JavaScript plugins) --><script src="https://AJAX.GoogleAPIs.com/AJAX/libs/jquery/1.12.4/jquery.min.Js"></script><!-- Include all compiled plugins (below),or include indivIDual files as needed --><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/Js/bootstrap.min.Js"></script></body></HTML>解决方法 问题是关于为pdfkit设置dpi参数. 因此,如果遇到同样的问题,只需根据需要设置dpi即可.对我来说,这就是我所需要的
options = { 'page-size': 'A4','dpi': 400 } 总结 以上是内存溢出为你收集整理的html – pdfkit生成小规模的pdf全部内容,希望文章能够帮你解决html – pdfkit生成小规模的pdf所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)