PDFHelperGeneratePDF(Uri, String, 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(
Uri uri,
string documentTitle,
ObjectSettings objectSettings
)
- uri Uri
- 網址
- documentTitle String
- 文件標題
- objectSettings ObjectSettings
- 轉換設定
StreamStream
Uri uri = new Uri("http://www.ebizprise.com/web/index.php/site/index.html");
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, "eBizprise document title", 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/01/16 | 2.2.0.0 | 調整HTML取得方式為API助手 |
| 2025/09/10 | 2.2.5.0 | 調整統一介面定義 |
| 2025/09/19 | 25.0.0.0 | 彙整2025年度初版 |