PDFHelperGeneratePDF(GlobalSettings, ObjectSettings) Method
由HTML產出PDF文件
Namespace: eBizprise.UtilityAssembly: eBizprise.Utility.PDFHelper (in eBizprise.Utility.PDFHelper.dll) Version: 25.0.0.0+adf38c4ccb2bf98d8ad258a6278302b5e05a94ed
public static Stream GeneratePDF(
GlobalSettings globalSettings,
ObjectSettings objectSettings
)
- globalSettings GlobalSettings
- 全域設定
- objectSettings ObjectSettings
- 轉換設定
StreamStream
GlobalSettings globalSettings = new GlobalSettings() { ColorMode = ColorMode.Grayscale, DocumentTitle = "eBizprise document title" };
ObjectSettings objectSettings = new ObjectSettings() { FooterSettings = { FontSize = 9, Right = "第 [page] 頁,共 [toPage] 頁", Line = true, Spacing = 2.812 }, HtmlContent = "This is eBizprise framework <h1>PDFHelper</h1> sample.", PagesCount = true, WebSettings = { DefaultEncoding = "utf-8" } };
Stream stream = PDFHelper.GeneratePDF(globalSettings, objectSettings);
// 寫入檔案
using (FileStream fileStream = new FileStream("PdfHelperTest.pdf", FileMode.Open))
{
byte[] bytesInStream = new byte[stream.Length];
stream.Read(bytesInStream, 0, bytesInStream.Length);
fileStream.Write(bytesInStream, 0, bytesInStream.Length);
fileStream.Flush();
}
| Date | Version | Description |
|---|
| 2020/02/07 | 1.0.0.0 | 初版 |
| 2025/09/19 | 25.0.0.0 | 彙整2025年度初版 |