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 ? –