标签: html2pdf

如何在渲染 pdf 时为 html2pdf 指定页眉/页脚?

我正在使用 html2pdf python 库,并且想定义一个页眉和页脚以应用于每个页面(包括有趣的东西,比如页脚的页数)。我可以用来指定带有 html2pdf 的页眉/页脚的最方便的方法是什么?

python html2pdf

3
推荐指数
2
解决办法
2万
查看次数

有什么办法可以将 Highcharts 与 mPDF 转换器一起使用吗?

这个问题与 HTMLtoPDF 转换器有关。

mPDF 转换器与包含的 css 一起工作正常,但不适用于任何 Bootstrap Table 或任何 svg 元素。

如何在 html 中为 mPDF 包含 js?

php svg highcharts html2pdf mpdf

3
推荐指数
1
解决办法
2103
查看次数

jsPDF:使用新的.html()方法时未加载html2canvas

我想使用jsPDF.html将html页面转换为pdf,我正在使用以下代码:

savePdf () {
  var pdf = new jsPDF({unit: 'mm', format: 'a4', orientation: 'portrait' })
  pdf.html(document.getElementById('printable-cv'), {
    callback: function (pdf) {
      pdf.save('cv-a4.pdf');
    }
  })
}
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误html2canvas not loaded:我忘了吗?我有html2canvas

“ html2canvas”:“ ^ 1.0.0-alpha.12”

我正在将vuejs与webpack一起使用。

在同一页面中,我当前正在使用带有以下代码的html2pdf

savePdf0 () {
  let opt = {
    filename: 'cv.pdf',
    enableLinks: true,
    image: { type: 'jpeg', quality: 0.98 },
    html2canvas: {
      scale: 8,
      useCORS: true,
      width: 310,
      letterRendering: true,
    },
    jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' },
  }
  html2pdf().set(opt).from(document.getElementById('printable-cv')).save() …
Run Code Online (Sandbox Code Playgroud)

html2pdf html2canvas jspdf

3
推荐指数
2
解决办法
5335
查看次数

pdf下载html2pdf

我正在使用html2pdf类生成pdf.在我的问题中它为html代码生成pdf但它没有给出对话框选项来下载该pdf.请帮助我的cose跟随.

<?php
ob_start();
include(dirname(__FILE__).'/res/pdf_demo.php');
$content = ob_get_clean();

// conversion HTML => PDF
require_once(dirname(__FILE__).'/../html2pdf.class.php');
try
{
    $html2pdf = new HTML2PDF('P','A4', 'fr', false, 'ISO-8859-15');
    $html2pdf->pdf->SetDisplayMode('fullpage');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $html2pdf->Output('pdf_demo.pdf'); 
}
catch(HTML2PDF_exception $e) { echo $e; }
?>
Run Code Online (Sandbox Code Playgroud)

php pdf download html2pdf

2
推荐指数
2
解决办法
2万
查看次数

转换 - 当我将html内容转换为pdf时,旋转和缩放不起作用

我正在使用html2pdf将html内容与图像转换为pdf,我还添加了旋转和翻转图像的选项...现在正在成功创建pdf ...但是如果我使用css旋转或翻转任何图像 transform:rotate(90deg);

transform:scaleX(-1);
Run Code Online (Sandbox Code Playgroud)

然后在pdf文件中,图像看起来没有旋转或翻转......任何想法摆脱这个问题...请分享......或任何解决方案.

提前致谢.

css transform rotation scale html2pdf

2
推荐指数
2
解决办法
6522
查看次数

对日语(utf8)的 HTML2PDF 支持不起作用

对于 PHP 中的报告生成,我使用的是 HTML2PDF。

它适用于英语,但不能为日语提供适当的输出。

如何在 hHTML2PDF 库中设置 utg8 字符。

有没有办法在 HTML2PDF 库中实现这一点。我得到像“???????????????”这样的输出 而不是日语文本

在 /var/www/html/html2pdf/locale 文件夹中,我找到了 en.csv、fr.cvs、cs.csv、da.csv

我们也可以为日语获得这样的文件吗?

下面是我的代码

<?php

$content = ob_get_clean();

// convert to PDF
require_once('Classes/library/html2pdf.class.php');
try {
    $html2pdf = new HTML2PDF('P', 'A4', 'en');
    $html2pdf->pdf->SetDisplayMode('fullpage');
//      $html2pdf->pdf->SetProtection(array('print'), 'spipu');
    $html2pdf->writeHTML($content, isset($_GET['vuehtml']));
    $filename = $filename .'_'.date('Ymd');
    $html2pdf->Output($filename.'.pdf','D');//,'D'
}
catch(HTML2PDF_exception $e) {
    echo $e;
    exit;
}
Run Code Online (Sandbox Code Playgroud)

php mysql html2pdf

2
推荐指数
1
解决办法
9506
查看次数

HTML2PDF - TD 标签的内容不能仅容纳在一页上

当不跨越、使用嵌套表以及

\n\n
HTML2PDF::$_subobj->pdf->getPage();\n
Run Code Online (Sandbox Code Playgroud)\n\n

似乎没有解决错误/问题。有人遇到过这个错误 n\xc2\xb07 吗?

\n

php html2pdf

2
推荐指数
1
解决办法
5707
查看次数

如何在 html2pdf 中包含外部类 css?

如何在 html2pdf 中添加类?我已经测试过

$stylesheet = file_get_contents('../printpdf.css');
Run Code Online (Sandbox Code Playgroud)

但这不起作用。

css html2pdf

2
推荐指数
1
解决办法
4603
查看次数

xhtml2pdf 在创建 pdf(html 到 pdf)时不应用 css

转换:

html = template.render(context)
resultFile = open(filepath, "w+b")
pdf = pisa.CreatePDF(html.encode('utf-8'), dest=resultFile,encoding='utf-8', link_callback=link_callback)
Run Code Online (Sandbox Code Playgroud)

链接回调

def link_callback(uri, rel):
    sUrl = settings.STATIC_URL      # Typically /static/
    sRoot = settings.STATIC_ROOT    
    mUrl = settings.MEDIA_URL       # Typically /static/media/
    mRoot = settings.MEDIA_ROOT     # Typically /home/userX/project_static/media/

    # convert URIs to absolute system paths
    if uri.startswith(mUrl):
        path = os.path.join(mRoot, uri.replace(mUrl, ""))
    elif uri.startswith(sUrl):
        path = os.path.join(sRoot, uri.replace(sUrl, ""))
    else:
        return uri  # handle absolute uri (ie: http://some.tld/foo.png)

    # make sure that file exists
    if not os.path.isfile(path):
        raise Exception(
            'media …
Run Code Online (Sandbox Code Playgroud)

html css django html2pdf xhtml2pdf

2
推荐指数
1
解决办法
6765
查看次数

如何在 html2pdf.js 上添加页脚

告诉我如何使用 html2pdf.js [工作版本]向每个页面添加页脚][1]

  function test() {
    // Get the element.
    var element = document.getElementById('the-document');




    // Generate the PDF.
    html2pdf().from(element).set({
      filename:  'test.pdf',
      image: {type: 'jpeg',quality: 1.0},
            html2canvas: {dpi: 75, scale: 2, letterRendering: true},
      pagebreak: { mode: ['avoid-all', 'css', 'legacy'] },
      jsPDF: {orientation: 'portrait', unit: 'in', format: 'a4', compressPDF: true},
      // pdfCallback: pdfCallback
    }).save();

  }
Run Code Online (Sandbox Code Playgroud)

html2pdf

2
推荐指数
1
解决办法
9977
查看次数

标签 统计

html2pdf ×10

php ×4

css ×3

django ×1

download ×1

highcharts ×1

html ×1

html2canvas ×1

jspdf ×1

mpdf ×1

mysql ×1

pdf ×1

python ×1

rotation ×1

scale ×1

svg ×1

transform ×1

xhtml2pdf ×1