PDFHelperGeneratePDF(GlobalSettings, ObjectSettings) Method

由HTML產出PDF文件

Definition

Namespace: eBizprise.Utility
Assembly: eBizprise.Utility.PDFHelper (in eBizprise.Utility.PDFHelper.dll) Version: 25.0.0.0+adf38c4ccb2bf98d8ad258a6278302b5e05a94ed
C#
public static Stream GeneratePDF(
	GlobalSettings globalSettings,
	ObjectSettings objectSettings
)

Parameters

globalSettings  GlobalSettings
全域設定
objectSettings  ObjectSettings
轉換設定

Return Value

Stream
Stream

Example

C#
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();
}

Revision History

DateVersionDescription
2020/02/071.0.0.0初版
2025/09/1925.0.0.0彙整2025年度初版

See Also