使用AbcPdf将HTML转换为PDF时的分页符 [英] Page break when HTML to PDF with AbcPdf

查看:431
本文介绍了使用AbcPdf将HTML转换为PDF时的分页符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用abcPdf创建PDF格式的报告。一切正常,但我想在每个页面的底部添加一个页码和页边空白以及避免在一行中间切割,如图所示:

I'm trying to create a report in PDF with abcPdf. Everything works but I would like to add a page number and margin at the bottom of each page as well as avoid cuts in the middle of a row as you can see in the picture:

var theDoc = new Doc { TopDown = true };
var pageRef = theDoc.AddImageUrl(pdfUrl, true, 1903, true);
while (theDoc.Chainable(pageRef))
{
    theDoc.Page = theDoc.AddPage();
    //I guessI have to do something here???
    pageRef = theDoc.AddImageToChain(pageRef);
}

有人知道这是否可能吗?

Does somebody know if it is possible?

推荐答案

它确实有效,但我认为AbcPdf使用IE的HTML渲染,因此您可以做的最好的事情就是手动将渲染引擎设置为gecko(Dont忘记你需要额外的DLL)或者更新你的Web服务器中的IE。

It did work but I think AbcPdf is using the HTML rendering of IE so the best thing you can do is to manually set the rendering engine to be gecko (Dont forget that you need and extra DLL) or to update IE in your web server.

theDoc.HtmlOptions.Engine = EngineType.Gecko; 

然后添加分页符只需使用

Then to add a page break just use

<div style="page-break-before:always">&nbsp;</div> 

感谢feeela的评论。

Thanks to feeela for the comment.

这篇关于使用AbcPdf将HTML转换为PDF时的分页符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆