PDFHelperGeneratePDF(Uri, 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(
	Uri uri,
	GlobalSettings globalSettings,
	ObjectSettings objectSettings
)

Parameters

uri  Uri
網址
globalSettings  GlobalSettings
全域設定
objectSettings  ObjectSettings
轉換設定

Return Value

Stream
Stream

Example

C#
Uri uri = new Uri("http://www.ebizprise.com/web/index.php/site/index.html");
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 }, PagesCount = true, WebSettings = { DefaultEncoding = "utf-8" } };
Stream stream = PDFHelper.GeneratePDF(uri, 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/01/162.2.0.0調整HTML取得方式為API助手
2025/09/102.2.5.0調整統一介面定義
2025/09/1925.0.0.0彙整2025年度初版

See Also