0
我正在使用专业PDF从HTML生成PDF。 我必须在除第一页外的所有页面上生成页脚。 我尝试过:专家PDF - 在第一页上除页面外所有页面添加页脚
PdfConverter pdfConverter = new PdfConverter();
AddFooter(pdfConverter);
private void AddFooter(PdfConverter pdfConverter)
{
string thisPageURL = HttpContext.Current.Request.Url.AbsoluteUri;
string headerAndFooterHtmlUrl = thisPageURL.Substring(0, thisPageURL.LastIndexOf('/')) + "/HeaderAndFooterHtml.htm";
//enable footer
pdfConverter.PdfDocumentOptions.ShowFooter = true;
// set the footer height in points
pdfConverter.PdfFooterOptions.FooterHeight = 60;
//write the page number
pdfConverter.PdfFooterOptions.TextArea = new TextArea(0, 30, "This is page &p; of &P; ",
new System.Drawing.Font(new System.Drawing.FontFamily("Times New Roman"), 10, System.Drawing.GraphicsUnit.Point));
pdfConverter.PdfFooterOptions.TextArea.EmbedTextFont = true;
pdfConverter.PdfFooterOptions.TextArea.TextAlign = HorizontalTextAlign.Right;
// set the footer HTML area
pdfConverter.PdfFooterOptions.HtmlToPdfArea = new HtmlToPdfArea(0, 0, -1, pdfConverter.PdfFooterOptions.FooterHeight,
headerAndFooterHtmlUrl, 1024, -1);
pdfConverter.PdfFooterOptions.HtmlToPdfArea.FitHeight = true;
}
但这段代码在所有页面上都生成页脚。
有人可以给我这个问题的想法或解决方案吗?
在此先感谢!
哪里可以pdfConverter类可以找到?我需要它用于我的项目。 –
检查库https://www.html-to-pdf.net/docs/html-to-pdf-library/html/T_ExpertPdf_HtmlToPdf_PdfConverter.htm –
对不起,我应该问过,但是这是可以用在JAVA ? –