{"id":585,"date":"2026-04-03T10:36:55","date_gmt":"2026-04-03T02:36:55","guid":{"rendered":"https:\/\/www.hyw.life\/?p=585"},"modified":"2026-04-03T11:03:41","modified_gmt":"2026-04-03T03:03:41","slug":"net-minipdf-%e9%9b%86%e6%88%90%e5%bc%80%e5%8f%91%e8%af%a6%e7%bb%86%e8%af%b4%e6%98%8e%e6%96%87%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/www.hyw.life\/?p=585","title":{"rendered":".NET MiniPdf \u96c6\u6210\u5f00\u53d1\u8be6\u7ec6\u8bf4\u660e\u6587\u6863"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u7248\u672c<\/strong>\uff1a\u9002\u7528\u4e8e MiniPdf 0.16.0 \u53ca\u4ee5\u4e0a\u7248\u672c<br><strong>\u8bb8\u53ef\u534f\u8bae<\/strong>\uff1aApache 2.0\uff0c\u5f00\u6e90\u53ef\u514d\u8d39\u5546\u7528<br><strong>\u5b98\u65b9\u4ed3\u5e93<\/strong>\uff1a<a href=\"https:\/\/github.com\/mini-software\/MiniPdf\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><a href=\"https:\/\/github.com\/mini-software\/MiniPdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/mini-software\/MiniPdf<\/a><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-0\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">\u76ee\u5f55<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#1-%E6%A6%82%E8%BF%B0\" target=\"_blank\" rel=\"noreferrer noopener\">\u6982\u8ff0<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#2-%E7%8E%AF%E5%A2%83%E8%A6%81%E6%B1%82\" target=\"_blank\" rel=\"noreferrer noopener\">\u73af\u5883\u8981\u6c42<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#3-%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F\" target=\"_blank\" rel=\"noreferrer noopener\">\u5b89\u88c5\u65b9\u5f0f<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#4-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B\" target=\"_blank\" rel=\"noreferrer noopener\">\u5feb\u901f\u5f00\u59cb<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#5-api-%E5%8F%82%E8%80%83\" target=\"_blank\" rel=\"noreferrer noopener\">API \u53c2\u8003<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#6-%E8%BF%9B%E9%98%B6%E4%BD%BF%E7%94%A8\" target=\"_blank\" rel=\"noreferrer noopener\">\u8fdb\u9636\u4f7f\u7528<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#7-%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%B7%A5%E5%85%B7minipdfcli\" target=\"_blank\" rel=\"noreferrer noopener\">\u547d\u4ee4\u884c\u5de5\u5177\uff08MiniPdf.Cli\uff09<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#8-%E5%9C%A8-web-%E9%A1%B9%E7%9B%AE%E4%B8%AD%E9%9B%86%E6%88%90\" target=\"_blank\" rel=\"noreferrer noopener\">\u5728 Web \u9879\u76ee\u4e2d\u96c6\u6210<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#9-%E5%AE%B9%E5%99%A8docker-%E7%8E%AF%E5%A2%83%E9%9B%86%E6%88%90\" target=\"_blank\" rel=\"noreferrer noopener\">\u5bb9\u5668\/Docker \u73af\u5883\u96c6\u6210<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#10-%E5%8A%9F%E8%83%BD%E6%94%AF%E6%8C%81%E8%AF%B4%E6%98%8E%E4%B8%8E%E5%B1%80%E9%99%90%E6%80%A7\" target=\"_blank\" rel=\"noreferrer noopener\">\u529f\u80fd\u652f\u6301\u8bf4\u660e\u4e0e\u5c40\u9650\u6027<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#11-%E6%80%A7%E8%83%BD%E4%B8%8E%E5%9F%BA%E5%87%86%E6%B5%8B%E8%AF%95\" target=\"_blank\" rel=\"noreferrer noopener\">\u6027\u80fd\u4e0e\u57fa\u51c6\u6d4b\u8bd5<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#12-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98-faq\" target=\"_blank\" rel=\"noreferrer noopener\">\u5e38\u89c1\u95ee\u9898 FAQ<\/a><\/li>\n\n\n\n<li><a href=\"vscode-file:\/\/vscode-app\/c:\/Users\/hyw88\/AppData\/Local\/Programs\/WorkBuddy\/resources\/app\/out\/vs\/code\/electron-sandbox\/workbench\/agentManager.html#13-%E7%9B%B8%E5%85%B3%E8%B5%84%E6%BA%90\" target=\"_blank\" rel=\"noreferrer noopener\">\u76f8\u5173\u8d44\u6e90<\/a><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-1\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">1. \u6982\u8ff0<\/h2>\n\n\n\n<span id=\"h3-2\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">1.1 \u4ec0\u4e48\u662f MiniPdf<\/h3>\n\n\n\n<p><strong>MiniPdf<\/strong>&nbsp;\u662f\u7531 mini-software \u56e2\u961f\uff08MiniExcel\u3001MiniWord \u540c\u4f5c\u8005\uff09\u5f00\u53d1\u7684\u4e00\u4e2a\u6781\u7b80\u3001\u96f6\u5916\u90e8\u4f9d\u8d56\u7684 .NET \u5e93\uff0c\u4e13\u4e3a\u5c06 Office \u6587\u4ef6\uff08Excel&nbsp;<code class=\"\">.xlsx<\/code>\u3001Word&nbsp;<code class=\"\">.docx<\/code>\uff09\u8f6c\u6362\u4e3a PDF \u800c\u8bbe\u8ba1\u3002<\/p>\n\n\n\n<p>\u5b83\u5b8c\u5168\u57fa\u4e8e .NET \u5185\u7f6e API \u5b9e\u73b0\uff0c<strong>\u65e0\u9700\u5b89\u88c5 Microsoft Office\u3001LibreOffice\u3001Adobe Acrobat<\/strong>&nbsp;\u6216\u4efb\u4f55\u7b2c\u4e09\u65b9\u8f6f\u4ef6\uff0c\u662f\u76ee\u524d\u5168\u7403\u9996\u4e2a\u5f00\u6e90\u53ef\u5546\u7528\u7684 .NET Office \u8f6c PDF \u5de5\u5177\u3002<\/p>\n\n\n\n<span id=\"h3-3\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">1.2 \u6838\u5fc3\u4f18\u52bf<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u4f18\u52bf<\/th>\n<th style=\"text-align: center;\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">\u00a0\u96f6\u4f9d\u8d56<\/td>\n<td style=\"text-align: left;\">\u4e0d\u4f9d\u8d56 COM\u3001Office\u3001LibreOffice\u3001Docker<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u8f7b\u91cf\u5316<\/td>\n<td>\u4ec5\u4f7f\u7528 .NET \u5185\u7f6e API\uff0c\u5305\u4f53\u79ef\u5c0f<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u514d\u8d39\u5546\u7528<\/td>\n<td>Apache 2.0 \u534f\u8bae\uff0c\u4f01\u4e1a\u9879\u76ee\u53ef\u76f4\u63a5\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u00a0\u8de8\u5e73\u53f0<\/td>\n<td>\u652f\u6301 Windows \/ Linux \/ macOS<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u00a0Serverless \u5c31\u7eea<\/td>\n<td>\u9002\u5408\u4e91\u51fd\u6570\u3001\u5bb9\u5668\u5316\u90e8\u7f72<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6807\u51c6\u8f93\u51fa<\/td>\n<td>\u751f\u6210\u7b26\u5408 PDF 1.4 \u6807\u51c6\u7684\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u00a0Native AOT<\/td>\n<td style=\"text-align: left;\">\u652f\u6301\u7f16\u8bd1\u4e3a\u96f6\u4f9d\u8d56\u7684\u539f\u751f\u53ef\u6267\u884c\u6587\u4ef6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<span id=\"h3-4\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">1.3 \u5185\u90e8\u6280\u672f\u67b6\u6784<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>MiniPdf.ConvertToPdf\uff08\u516c\u5171 API \u5165\u53e3\uff09\n         \u2502\n         \u251c\u2500\u2192 ExcelToPdfConverter\uff08Excel \u89e3\u6790 + \u5e03\u5c40\u5f15\u64ce\uff09\n         \u2502           \u2502\n         \u2502           \u2514\u2500\u2192 ExcelReader\uff08\u89e3\u6790 .xlsx Open XML\uff09\n         \u2502\n         \u251c\u2500\u2192 WordToPdfConverter\uff08Word \u89e3\u6790 + \u5e03\u5c40\u5f15\u64ce\uff09\n         \u2502\n         \u2514\u2500\u2192 PdfWriter\uff08PDF 1.4 \u6587\u6863\u751f\u6210\u5668\uff09\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-5\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">2. \u73af\u5883\u8981\u6c42<\/h2>\n\n\n\n<span id=\"h3-6\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">2.1 \u652f\u6301\u7684 .NET \u6846\u67b6\u7248\u672c<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u6846\u67b6<\/th>\n<th style=\"text-align: center;\">\u6700\u4f4e\u7248\u672c<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">.NET Framework<\/td>\n<td style=\"text-align: center;\">4.6.2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">.NET Standard<\/td>\n<td style=\"text-align: center;\">2.0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">.NET Core \/ .NET<\/td>\n<td style=\"text-align: center;\">6.0\u30018.0\u30019.0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<span id=\"h3-7\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">2.2 \u4f9d\u8d56\u8bf4\u660e<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u76ee\u6807\u6846\u67b6<\/th>\n<th style=\"text-align: center;\">\u6240\u9700\u4f9d\u8d56<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">.NET Framework 4.6.2<\/td>\n<td style=\"text-align: center;\"><code class=\"\">System.Memory \u2265 4.5.5<\/code>\u3001<code class=\"\">System.ValueTuple \u2265 4.5.0<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">.NET Standard 2.0<\/td>\n<td style=\"text-align: center;\"><code class=\"\">System.Drawing.Common \u2265 8.0.0<\/code>\u3001<code class=\"\">System.Memory \u2265 4.5.5<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">.NET 6.0 \/ 8.0 \/ 9.0<\/td>\n<td style=\"text-align: center;\"><code class=\"\">System.Drawing.Common \u2265 8.0.0<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u4ee5\u4e0a\u4f9d\u8d56\u5747\u7531 NuGet \u81ea\u52a8\u7ba1\u7406\uff0c\u65e0\u9700\u624b\u52a8\u5b89\u88c5\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-8\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">3. \u5b89\u88c5\u65b9\u5f0f<\/h2>\n\n\n\n<span id=\"h3-9\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">3.1 .NET CLI\uff08\u63a8\u8350\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet add package MiniPdf\n<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u6307\u5b9a\u7248\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet add package MiniPdf --version 0.16.0\n<\/code><\/pre>\n\n\n\n<span id=\"h3-10\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">3.2 Visual Studio Package Manager Console<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package MiniPdf\n<\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u6307\u5b9a\u7248\u672c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package MiniPdf -Version 0.16.0\n<\/code><\/pre>\n\n\n\n<span id=\"h3-11\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">3.3 \u9879\u76ee\u6587\u4ef6\uff08.csproj\uff09\u76f4\u63a5\u5f15\u7528<\/h3>\n\n\n\n<p>\u5728&nbsp;<code class=\"\">.csproj<\/code>&nbsp;\u6587\u4ef6\u7684&nbsp;<code class=\"\">&lt;ItemGroup&gt;<\/code>&nbsp;\u4e2d\u6dfb\u52a0\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ItemGroup&gt;\n  &lt;PackageReference Include=\"MiniPdf\" Version=\"0.16.0\" \/&gt;\n&lt;\/ItemGroup&gt;\n<\/code><\/pre>\n\n\n\n<span id=\"h3-12\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">3.4 Paket CLI<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>paket add MiniPdf --version 0.16.0\n<\/code><\/pre>\n\n\n\n<span id=\"h3-13\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">3.5 F# Interactive \/ Polyglot Notebooks<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#r \"nuget: MiniPdf, 0.16.0\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-14\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">4. \u5feb\u901f\u5f00\u59cb<\/h2>\n\n\n\n<span id=\"h3-15\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">4.1 \u5f15\u5165\u547d\u540d\u7a7a\u95f4<\/h3>\n\n\n\n<p>\u6240\u6709\u529f\u80fd\u5747\u901a\u8fc7&nbsp;<code class=\"\">MiniSoftware<\/code>&nbsp;\u547d\u540d\u7a7a\u95f4\u4e0b\u7684&nbsp;<code class=\"\">MiniPdf<\/code>&nbsp;\u9759\u6001\u7c7b\u63d0\u4f9b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n<\/code><\/pre>\n\n\n\n<span id=\"h3-16\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">4.2 \u57fa\u7840\u793a\u4f8b\uff1aExcel \u8f6c PDF<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\n<em>\/\/ \u5c06 Excel \u6587\u4ef6\u8f6c\u6362\u4e3a PDF \u6587\u4ef6<\/em>\nMiniPdf.ConvertToPdf(\"data.xlsx\", \"output.pdf\");\n\nConsole.WriteLine(\"\u8f6c\u6362\u5b8c\u6210\uff01\");\n<\/code><\/pre>\n\n\n\n<span id=\"h3-17\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">4.3 \u57fa\u7840\u793a\u4f8b\uff1aWord \u8f6c PDF<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\n<em>\/\/ \u5c06 Word \u6587\u4ef6\u8f6c\u6362\u4e3a PDF \u6587\u4ef6<\/em>\nMiniPdf.ConvertToPdf(\"report.docx\", \"output.pdf\");\n\nConsole.WriteLine(\"\u8f6c\u6362\u5b8c\u6210\uff01\");\n<\/code><\/pre>\n\n\n\n<span id=\"h3-18\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">4.4 \u8fd4\u56de\u5b57\u8282\u6570\u7ec4\uff08\u4e0d\u5199\u5165\u6587\u4ef6\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\n<em>\/\/ \u8f6c\u6362\u540e\u8fd4\u56de PDF \u7684\u5b57\u8282\u6570\u7ec4\uff0c\u4e0d\u76f4\u63a5\u5199\u5165\u78c1\u76d8<\/em>\nbyte&#91;] pdfBytes = MiniPdf.ConvertToPdf(\"data.xlsx\");\n\n<em>\/\/ \u53ef\u5c06 pdfBytes \u4fdd\u5b58\u5230\u6570\u636e\u5e93\u3001\u8fd4\u56de\u7ed9\u524d\u7aef\u6216\u505a\u8fdb\u4e00\u6b65\u5904\u7406<\/em>\nFile.WriteAllBytes(\"output.pdf\", pdfBytes);\n<\/code><\/pre>\n\n\n\n<span id=\"h3-19\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">4.5 \u4ece\u6587\u4ef6\u6d41\u8f6c\u6362<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\n<em>\/\/ \u4ece\u6587\u4ef6\u6d41\u8bfb\u53d6 Excel\uff0c\u8fd4\u56de PDF \u5b57\u8282\u6570\u7ec4<\/em>\nusing var inputStream = File.OpenRead(\"data.xlsx\");\nbyte&#91;] pdfBytes = MiniPdf.ConvertToPdf(inputStream);\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-20\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">5. API \u53c2\u8003<\/h2>\n\n\n\n<span id=\"h3-21\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">5.1 \u9759\u6001\u65b9\u6cd5\u603b\u89c8<\/h3>\n\n\n\n<p><code class=\"\">MiniPdf<\/code>&nbsp;\u7c7b\u63d0\u4f9b\u4ee5\u4e0b\u9759\u6001\u65b9\u6cd5\uff08\u5747\u4f4d\u4e8e&nbsp;<code class=\"\">MiniSoftware<\/code>&nbsp;\u547d\u540d\u7a7a\u95f4\uff09\uff1a<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u65b9\u6cd5\u7b7e\u540d<\/th>\n<th style=\"text-align: center;\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\"><code class=\"\">ConvertToPdf(string inputPath, string outputPath)<\/code><\/td>\n<td style=\"text-align: center;\">\u6587\u4ef6\u8def\u5f84 \u2192 \u6587\u4ef6\u8def\u5f84\uff08\u63a8\u8350\uff09<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><code class=\"\">ConvertToPdf(string inputPath) : byte[]<\/code><\/td>\n<td style=\"text-align: center;\">\u6587\u4ef6\u8def\u5f84 \u2192 \u5b57\u8282\u6570\u7ec4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><code class=\"\">ConvertToPdf(Stream inputStream) : byte[]<\/code><\/td>\n<td style=\"text-align: center;\">\u8f93\u5165\u6d41 \u2192 \u5b57\u8282\u6570\u7ec4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><code class=\"\">ConvertToPdf(Stream inputStream, Stream outputStream)<\/code><\/td>\n<td style=\"text-align: center;\">\u8f93\u5165\u6d41 \u2192 \u8f93\u51fa\u6d41<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><code class=\"\">RegisterFont(string fontName, byte[] fontBytes)<\/code><\/td>\n<td style=\"text-align: center;\">\u6ce8\u518c\u81ea\u5b9a\u4e49\u5b57\u4f53<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<span id=\"h3-22\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">5.2 \u65b9\u6cd5\u8be6\u7ec6\u8bf4\u660e<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><code class=\"\">ConvertToPdf(string inputPath, string outputPath)<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/\/ &lt;summary&gt;<\/em>\n<em>\/\/\/ \u5c06 Excel \u6216 Word \u6587\u4ef6\u8f6c\u6362\u4e3a PDF\uff0c\u76f4\u63a5\u5199\u5165\u76ee\u6807\u8def\u5f84<\/em>\n<em>\/\/\/ &lt;\/summary&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"inputPath\"&gt;\u8f93\u5165\u6587\u4ef6\u8def\u5f84\uff0c\u652f\u6301 .xlsx \/ .docx&lt;\/param&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"outputPath\"&gt;\u8f93\u51fa PDF \u6587\u4ef6\u8def\u5f84&lt;\/param&gt;<\/em>\npublic static void ConvertToPdf(string inputPath, string outputPath);\n<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MiniPdf.ConvertToPdf(@\"C:\\Documents\\report.xlsx\", @\"C:\\Output\\report.pdf\");\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><code class=\"\">ConvertToPdf(string inputPath) : byte[]<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/\/ &lt;summary&gt;<\/em>\n<em>\/\/\/ \u5c06 Excel \u6216 Word \u6587\u4ef6\u8f6c\u6362\u4e3a PDF\uff0c\u8fd4\u56de\u5b57\u8282\u6570\u7ec4<\/em>\n<em>\/\/\/ &lt;\/summary&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"inputPath\"&gt;\u8f93\u5165\u6587\u4ef6\u8def\u5f84\uff0c\u652f\u6301 .xlsx \/ .docx&lt;\/param&gt;<\/em>\n<em>\/\/\/ &lt;returns&gt;PDF \u6587\u4ef6\u7684\u5b57\u8282\u6570\u7ec4&lt;\/returns&gt;<\/em>\npublic static byte&#91;] ConvertToPdf(string inputPath);\n<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>byte&#91;] pdfData = MiniPdf.ConvertToPdf(\"invoice.xlsx\");\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><code class=\"\">ConvertToPdf(Stream inputStream) : byte[]<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/\/ &lt;summary&gt;<\/em>\n<em>\/\/\/ \u4ece\u8f93\u5165\u6d41\u8bfb\u53d6 Office \u6587\u4ef6\uff0c\u8f6c\u6362\u4e3a PDF \u5b57\u8282\u6570\u7ec4<\/em>\n<em>\/\/\/ &lt;\/summary&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"inputStream\"&gt;\u8f93\u5165\u6d41\uff08.xlsx \u6216 .docx \u683c\u5f0f\uff09&lt;\/param&gt;<\/em>\n<em>\/\/\/ &lt;returns&gt;PDF \u6587\u4ef6\u7684\u5b57\u8282\u6570\u7ec4&lt;\/returns&gt;<\/em>\npublic static byte&#91;] ConvertToPdf(Stream inputStream);\n<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using var stream = File.OpenRead(\"report.xlsx\");\nbyte&#91;] pdfBytes = MiniPdf.ConvertToPdf(stream);\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><code class=\"\">RegisterFont(string fontName, byte[] fontBytes)<\/code><\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/\/ &lt;summary&gt;<\/em>\n<em>\/\/\/ \u6ce8\u518c\u81ea\u5b9a\u4e49\u5b57\u4f53\uff0c\u7528\u4e8e\u66ff\u6362\u7cfb\u7edf\u5b57\u4f53\uff08\u9002\u5408\u65e0\u5b57\u4f53\u73af\u5883\uff09<\/em>\n<em>\/\/\/ \u5efa\u8bae\u5728\u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u8c03\u7528\uff0c\u4ec5\u9700\u6ce8\u518c\u4e00\u6b21<\/em>\n<em>\/\/\/ &lt;\/summary&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"fontName\"&gt;\u5b57\u4f53\u540d\u79f0\uff08\u81ea\u5b9a\u4e49\u6807\u8bc6\u7b26\uff09&lt;\/param&gt;<\/em>\n<em>\/\/\/ &lt;param name=\"fontBytes\"&gt;\u5b57\u4f53\u6587\u4ef6\u7684\u5b57\u8282\u6570\u7ec4\uff08\u652f\u6301 .ttf \/ .ttc\uff09&lt;\/param&gt;<\/em>\npublic static void RegisterFont(string fontName, byte&#91;] fontBytes);\n<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ \u7a0b\u5e8f\u542f\u52a8\u65f6\u6ce8\u518c\u5b57\u4f53\uff08Program.cs \u6216 Startup.cs\uff09<\/em>\nMiniPdf.RegisterFont(\"NotoSansSC\", File.ReadAllBytes(\"Fonts\/NotoSansSC-Regular.ttf\"));\nMiniPdf.RegisterFont(\"NotoColorEmoji\", File.ReadAllBytes(\"Fonts\/NotoColorEmoji.ttf\"));\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-23\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">6. \u8fdb\u9636\u4f7f\u7528<\/h2>\n\n\n\n<span id=\"h3-24\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">6.1 \u81ea\u5b9a\u4e49\u5b57\u4f53\uff08\u89e3\u51b3\u4e2d\u6587\u4e71\u7801\/\u5b57\u4f53\u7f3a\u5931\uff09<\/h3>\n\n\n\n<p>\u5728 Docker \u5bb9\u5668\u3001Blazor WASM\u3001Serverless \u7b49\u65e0\u5b57\u4f53\u73af\u5883\u4e2d\uff0c\u7cfb\u7edf\u53ef\u80fd\u7f3a\u5c11\u4e2d\u6587\u5b57\u4f53\uff0c\u5bfc\u81f4\u751f\u6210\u7684 PDF \u51fa\u73b0\u65b9\u6846\u6216\u4e71\u7801\u3002<br>\u89e3\u51b3\u65b9\u6848\uff1a\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u6ce8\u518c\u81ea\u5b9a\u4e49\u5b57\u4f53\u3002<\/p>\n\n\n\n<p><strong>\u6b65\u9aa4\u4e00\uff1a\u4e0b\u8f7d\u4e2d\u6587\u5b57\u4f53<\/strong><\/p>\n\n\n\n<p>\u63a8\u8350\u4f7f\u7528&nbsp;<a href=\"https:\/\/fonts.google.com\/noto\/specimen\/Noto+Sans+SC\" target=\"_blank\" rel=\"noreferrer noopener\">Noto Sans SC\uff08\u601d\u6e90\u9ed1\u4f53\uff09<\/a>\uff0c\u5f00\u6e90\u514d\u8d39\u53ef\u5546\u7528\u3002<\/p>\n\n\n\n<p><strong>\u6b65\u9aa4\u4e8c\uff1a\u5c06\u5b57\u4f53\u6587\u4ef6\u653e\u5165\u9879\u76ee<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MyProject\/\n\u251c\u2500\u2500 Fonts\/\n\u2502   \u2514\u2500\u2500 NotoSansSC-Regular.ttf\n\u251c\u2500\u2500 Program.cs\n<\/code><\/pre>\n\n\n\n<p>\u786e\u4fdd\u5b57\u4f53\u6587\u4ef6\u88ab\u590d\u5236\u5230\u8f93\u51fa\u76ee\u5f55\uff08<code class=\"\">.csproj<\/code>\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;ItemGroup&gt;\n  &lt;None Update=\"Fonts\\NotoSansSC-Regular.ttf\"&gt;\n    &lt;CopyToOutputDirectory&gt;Always&lt;\/CopyToOutputDirectory&gt;\n  &lt;\/None&gt;\n&lt;\/ItemGroup&gt;\n<\/code><\/pre>\n\n\n\n<p><strong>\u6b65\u9aa4\u4e09\uff1a\u6ce8\u518c\u5b57\u4f53<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ Program.cs\uff08\u4ec5\u9700\u5728\u5e94\u7528\u542f\u52a8\u65f6\u6267\u884c\u4e00\u6b21\uff09<\/em>\nMiniPdf.RegisterFont(\"NotoSansSC\", File.ReadAllBytes(\"Fonts\/NotoSansSC-Regular.ttf\"));\n<\/code><\/pre>\n\n\n\n<p><strong>\u6b65\u9aa4\u56db\uff1a\u6b63\u5e38\u8c03\u7528\u8f6c\u6362<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ \u6ce8\u518c\u5b57\u4f53\u540e\uff0c\u6b63\u5e38\u8c03\u7528\u5373\u53ef\uff0c\u5b57\u4f53\u4f1a\u81ea\u52a8\u5339\u914d<\/em>\nMiniPdf.ConvertToPdf(\"report.xlsx\", \"report.pdf\");\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-25\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">6.2 \u591a\u5b57\u4f53\u6ce8\u518c\u793a\u4f8b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ \u652f\u6301\u591a\u79cd\u5b57\u4f53\uff0c\u6309\u540d\u79f0\u6ce8\u518c<\/em>\nMiniPdf.RegisterFont(\"SimSun\", File.ReadAllBytes(\"Fonts\/simsun.ttf\"));         <em>\/\/ \u5b8b\u4f53<\/em>\nMiniPdf.RegisterFont(\"SimHei\", File.ReadAllBytes(\"Fonts\/simhei.ttf\"));         <em>\/\/ \u9ed1\u4f53<\/em>\nMiniPdf.RegisterFont(\"NotoEmoji\", File.ReadAllBytes(\"Fonts\/NotoColorEmoji.ttf\")); <em>\/\/ Emoji<\/em>\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-26\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">6.3 \u5f02\u5e38\u5904\u7406<\/h3>\n\n\n\n<p>\u5efa\u8bae\u5bf9\u8f6c\u6362\u903b\u8f91\u8fdb\u884c\u5f02\u5e38\u6355\u83b7\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\ntry\n{\n    MiniPdf.ConvertToPdf(\"input.xlsx\", \"output.pdf\");\n    Console.WriteLine(\"\u8f6c\u6362\u6210\u529f\");\n}\ncatch (FileNotFoundException ex)\n{\n    Console.WriteLine($\"\u6587\u4ef6\u672a\u627e\u5230\uff1a{ex.Message}\");\n}\ncatch (UnauthorizedAccessException ex)\n{\n    Console.WriteLine($\"\u6587\u4ef6\u8bbf\u95ee\u6743\u9650\u4e0d\u8db3\uff1a{ex.Message}\");\n}\ncatch (Exception ex)\n{\n    Console.WriteLine($\"\u8f6c\u6362\u5931\u8d25\uff1a{ex.Message}\");\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-27\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">6.4 \u6279\u91cf\u8f6c\u6362<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-28\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">7. \u547d\u4ee4\u884c\u5de5\u5177\uff08MiniPdf.Cli\uff09<\/h2>\n\n\n\n<span id=\"h3-29\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">7.1 \u5b89\u88c5 CLI \u5de5\u5177<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet tool install --global MiniPdf.Cli\n<\/code><\/pre>\n\n\n\n<p>\u9a8c\u8bc1\u5b89\u88c5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>minipdf --version\n<\/code><\/pre>\n\n\n\n<span id=\"h3-30\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">7.2 \u57fa\u672c\u547d\u4ee4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u5c06 Excel \u8f6c\u4e3a PDF\uff08\u8f93\u51fa\u5230\u540c\u76ee\u5f55\uff0c\u540c\u540d .pdf \u6587\u4ef6\uff09<\/em>\nminipdf data.xlsx\n\n<em># \u5c06 Word \u8f6c\u4e3a PDF<\/em>\nminipdf report.docx\n\n<em># \u6307\u5b9a\u8f93\u51fa\u8def\u5f84<\/em>\nminipdf report.docx -o \/path\/to\/output.pdf\nminipdf data.xlsx --output .\/result\/output.pdf\n\n<em># \u6307\u5b9a\u5b57\u4f53\u76ee\u5f55\uff08\u6279\u91cf\u6ce8\u518c\u76ee\u5f55\u4e0b\u6240\u6709\u5b57\u4f53\uff09<\/em>\nminipdf report.docx --fonts .\/Fonts\n\n<em># \u67e5\u770b\u5e2e\u52a9<\/em>\nminipdf --help\n<\/code><\/pre>\n\n\n\n<span id=\"h3-31\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">7.3 \u4f7f\u7528 Native AOT \u72ec\u7acb\u4e8c\u8fdb\u5236\uff08\u65e0\u9700 .NET \u8fd0\u884c\u65f6\uff09<\/h3>\n\n\n\n<p>\u9002\u7528\u4e8e\u670d\u52a1\u5668\u65e0 .NET \u8fd0\u884c\u65f6\u73af\u5883\uff0c\u4e0b\u8f7d\u7f16\u8bd1\u597d\u7684\u539f\u751f\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n\n\n\n<p><strong>\u4e0b\u8f7d\u5730\u5740<\/strong>\uff1a<a href=\"https:\/\/github.com\/shps951023\/MiniPdf\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub Releases<\/a><\/p>\n\n\n\n<p><strong>Windows \u4f7f\u7528\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u89e3\u538b\u540e\u76f4\u63a5\u8fd0\u884c\n.\\minipdf.exe report.docx -o report.pdf\n.\\minipdf.exe data.xlsx --fonts .\\Fonts -o output.pdf\n<\/code><\/pre>\n\n\n\n<p><strong>Linux \u4f7f\u7528\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u89e3\u538b<\/em>\ntar -xzf minipdf-linux-x64.tar.gz\n\n<em># \u8d4b\u6743<\/em>\nchmod +x minipdf\n\n<em># \u6267\u884c\u8f6c\u6362<\/em>\n.\/minipdf report.docx -o report.pdf\n.\/minipdf data.xlsx --fonts .\/Fonts\n<\/code><\/pre>\n\n\n\n<p><strong>macOS \u4f7f\u7528\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xzf minipdf-osx-x64.tar.gz\nchmod +x minipdf\n.\/minipdf data.xlsx -o output.pdf\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-32\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">8. \u5728 Web \u9879\u76ee\u4e2d\u96c6\u6210<\/h2>\n\n\n\n<span id=\"h3-33\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">8.1 ASP.NET Core Web API \u793a\u4f8b<\/h3>\n\n\n\n<p>\u5728 HTTP \u63a5\u53e3\u4e2d\u63a5\u6536\u6587\u4ef6\uff0c\u8f6c\u6362\u540e\u76f4\u63a5\u8fd4\u56de PDF \u6d41\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>using Microsoft.AspNetCore.Mvc;\nusing MiniSoftware;\n\n&#91;ApiController]\n&#91;Route(\"api\/&#91;controller]\")]\npublic class PdfController : ControllerBase\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ \u4e0a\u4f20 Excel\/Word \u6587\u4ef6\uff0c\u8fd4\u56de\u8f6c\u6362\u540e\u7684 PDF\n    \/\/\/ &lt;\/summary>\n    &#91;HttpPost(\"convert\")]\n    public IActionResult ConvertToPdf(IFormFile file)\n    {\n        if (file == null || file.Length == 0)\n            return BadRequest(\"\u8bf7\u4e0a\u4f20\u6587\u4ef6\");\n\n        var ext = Path.GetExtension(file.FileName).ToLower();\n        if (ext != \".xlsx\" &amp;&amp; ext != \".docx\")\n            return BadRequest(\"\u4ec5\u652f\u6301 .xlsx \u548c .docx \u683c\u5f0f\");\n\n        try\n        {\n            using var inputStream = file.OpenReadStream();\n            byte&#91;] pdfBytes = MiniPdf.ConvertToPdf(inputStream);\n\n            return File(pdfBytes, \"application\/pdf\", \n                Path.GetFileNameWithoutExtension(file.FileName) + \".pdf\");\n        }\n        catch (Exception ex)\n        {\n            return StatusCode(500, $\"\u8f6c\u6362\u5931\u8d25\uff1a{ex.Message}\");\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<span id=\"h3-34\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">8.2 ASP.NET Core Minimal API \u793a\u4f8b<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>using MiniSoftware;\n\nvar builder = WebApplication.CreateBuilder(args);\n\n<em>\/\/ \u6ce8\u518c\u5b57\u4f53\uff08\u9002\u5408\u5bb9\u5668\u73af\u5883\uff09<\/em>\nMiniPdf.RegisterFont(\"NotoSansSC\", \n    File.ReadAllBytes(\"Fonts\/NotoSansSC-Regular.ttf\"));\n\nvar app = builder.Build();\n\napp.MapPost(\"\/convert\", async (IFormFile file) =&gt;\n{\n    using var stream = file.OpenReadStream();\n    var pdfBytes = MiniPdf.ConvertToPdf(stream);\n    return Results.File(pdfBytes, \"application\/pdf\", \n        Path.ChangeExtension(file.FileName, \".pdf\"));\n});\n\napp.Run();\n<\/code><\/pre>\n\n\n\n<span id=\"h3-35\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">8.3 \u4e0b\u8f7d PDF \u5230\u6d4f\u89c8\u5668\uff08\u5185\u8054\/\u9644\u4ef6\uff09<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ \u5728\u6d4f\u89c8\u5668\u4e2d\u76f4\u63a5\u9884\u89c8 PDF\uff08\u5185\u8054\uff09<\/em>\nResponse.Headers&#91;\"Content-Disposition\"] = \"inline; filename=output.pdf\";\nResponse.ContentType = \"application\/pdf\";\nawait Response.Body.WriteAsync(pdfBytes);\n\n<em>\/\/ \u6216\u4f5c\u4e3a\u9644\u4ef6\u4e0b\u8f7d<\/em>\nreturn File(pdfBytes, \"application\/pdf\", \"output.pdf\");\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-36\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">9. \u5bb9\u5668\/Docker \u73af\u5883\u96c6\u6210<\/h2>\n\n\n\n<span id=\"h3-37\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">9.1 Dockerfile \u793a\u4f8b<\/h3>\n\n\n\n<p>\u7531\u4e8e MiniPdf \u65e0\u9700 LibreOffice \/ Office\uff0cDockerfile \u6781\u4e3a\u7b80\u6d01\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FROM mcr.microsoft.com\/dotnet\/aspnet:8.0 AS base\nWORKDIR \/app\nEXPOSE 80\n\n# \u5b89\u88c5\u4e2d\u6587\u5b57\u4f53\u652f\u6301\uff08\u53ef\u9009\uff0c\u6216\u4f7f\u7528 RegisterFont \u4ee3\u66ff\uff09\nRUN apt-get update &amp;&amp; apt-get install -y fonts-noto-cjk &amp;&amp; rm -rf \/var\/lib\/apt\/lists\/*\n\nFROM mcr.microsoft.com\/dotnet\/sdk:8.0 AS build\nWORKDIR \/src\nCOPY &#91;\"MyApp.csproj\", \".\"]\nRUN dotnet restore\nCOPY . .\nRUN dotnet build -c Release -o \/app\/build\n\nFROM build AS publish\nRUN dotnet publish -c Release -o \/app\/publish\n\nFROM base AS final\nWORKDIR \/app\nCOPY --from=publish \/app\/publish .\n\n# \u590d\u5236\u81ea\u5b9a\u4e49\u5b57\u4f53\uff08\u63a8\u8350\u65b9\u5f0f\uff09\nCOPY Fonts\/ .\/Fonts\/\n\nENTRYPOINT &#91;\"dotnet\", \"MyApp.dll\"]<\/code><\/pre>\n\n\n\n<span id=\"h3-38\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">9.2 \u4f7f\u7528\u5185\u5d4c\u5b57\u4f53\uff08\u63a8\u8350\u751f\u4ea7\u73af\u5883\uff09<\/h3>\n\n\n\n<p>\u4e0d\u4f9d\u8d56\u7cfb\u7edf\u5b57\u4f53\uff0c\u5c06\u5b57\u4f53\u6587\u4ef6\u6253\u5305\u8fdb\u9879\u76ee\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ Program.cs<\/em>\nvar fontPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, \"Fonts\");\nif (Directory.Exists(fontPath))\n{\n    foreach (var fontFile in Directory.GetFiles(fontPath, \"*.ttf\"))\n    {\n        var fontName = Path.GetFileNameWithoutExtension(fontFile);\n        MiniPdf.RegisterFont(fontName, File.ReadAllBytes(fontFile));\n    }\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-39\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">10. \u529f\u80fd\u652f\u6301\u8bf4\u660e\u4e0e\u5c40\u9650\u6027<\/h2>\n\n\n\n<span id=\"h3-40\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">10.1 Excel (.xlsx) \u529f\u80fd\u652f\u6301\u77e9\u9635<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u529f\u80fd<\/th>\n<th style=\"text-align: center;\">\u652f\u6301\u72b6\u6001<\/th>\n<th style=\"text-align: center;\">\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">\u57fa\u7840\u6587\u672c\u5185\u5bb9<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td style=\"text-align: center;\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5b57\u4f53\uff08\u540d\u79f0\u3001\u5927\u5c0f\u3001\u7c97\u4f53\u3001\u659c\u4f53\uff09<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td style=\"text-align: center;\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5355\u5143\u683c\u80cc\u666f\u8272 \/ \u5b57\u4f53\u989c\u8272<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6587\u672c\u5bf9\u9f50\uff08\u6c34\u5e73 \/ \u5782\u76f4\uff09<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5408\u5e76\u5355\u5143\u683c<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u8fb9\u6846\u6837\u5f0f<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5d4c\u5165\u56fe\u7247\uff08JPEG \/ PNG\uff09<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6570\u5b57\u683c\u5f0f\u5316<\/td>\n<td style=\"text-align: center;\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u591a\u5de5\u4f5c\u8868<\/td>\n<td style=\"text-align: center;\">\u2705 \u652f\u6301<\/td>\n<td style=\"text-align: center;\">\u6bcf\u4e2a Sheet \u5bf9\u5e94 PDF \u4e2d\u7684\u72ec\u7acb\u9875<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u56fe\u8868\uff08Charts\uff09<\/td>\n<td style=\"text-align: center;\">\u26a0\ufe0f \u90e8\u5206\u652f\u6301<\/td>\n<td style=\"text-align: center;\">\u6e32\u67d3\u4e3a\u7b80\u5316\u77e2\u91cf\u8fd1\u4f3c\uff0c\u590d\u6742\u56fe\u8868\u4fdd\u771f\u5ea6\u8f83\u4f4e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u957f\u6587\u672c\u81ea\u52a8\u6362\u884c<\/td>\n<td style=\"text-align: center;\">\u274c \u5df2\u77e5\u7f3a\u9677<\/td>\n<td style=\"text-align: center;\">\u8d85\u51fa\u5217\u5bbd\u7684\u6587\u672c\u4f1a\u88ab\u622a\u65ad\uff0c\u5f85\u4fee\u590d<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">CJK \u5b57\u7b26\uff08\u4e2d\u65e5\u97e9\uff09<\/td>\n<td style=\"text-align: center;\">\u26a0\ufe0f \u90e8\u5206\u652f\u6301<\/td>\n<td style=\"text-align: center;\">\u53ef\u901a\u8fc7 RegisterFont \u89e3\u51b3\u95f4\u8ddd\u95ee\u9898<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6570\u636e\u900f\u89c6\u8868<\/td>\n<td style=\"text-align: center;\">\u274c \u4e0d\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">VBA \u5b8f<\/td>\n<td style=\"text-align: center;\">\u274c \u4e0d\u652f\u6301<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<span id=\"h3-41\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">10.2 Word (.docx) \u529f\u80fd\u652f\u6301\u77e9\u9635<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u529f\u80fd<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u652f\u6301\u72b6\u6001<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">\u57fa\u7840\u6bb5\u843d\u6587\u672c<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5b57\u4f53\u6837\u5f0f\uff08\u7c97\u4f53\u3001\u659c\u4f53\u3001\u4e0b\u5212\u7ebf\uff09<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6807\u9898\u4e0e\u5217\u8868<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u2705 \u5b8c\u5168\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u8868\u683c<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u2705 \u652f\u6301<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5d4c\u5165\u56fe\u7247<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u2705 \u652f\u6301<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u590d\u6742\u6392\u7248\uff08\u591a\u680f\u3001\u6587\u672c\u6846\uff09<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u26a0\ufe0f \u6709\u9650\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u9875\u7709 \/ \u9875\u811a<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u26a0\ufe0f \u90e8\u5206\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u76ee\u5f55\uff08TOC\uff09<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u274c \u4e0d\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u4fee\u8ba2\u8bb0\u5f55<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u274c \u4e0d\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<span id=\"h3-42\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">10.3 \u4f7f\u7528\u5efa\u8bae<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5bf9\u4e8e\u7b80\u5355\u8868\u683c\u548c\u6587\u6863<\/strong>\uff1aMiniPdf \u6548\u679c\u4f18\u79c0\uff0c\u63a8\u8350\u76f4\u63a5\u4f7f\u7528\u3002<\/li>\n\n\n\n<li><strong>\u5bf9\u4e8e\u590d\u6742\u56fe\u8868<\/strong>\uff1a\u5efa\u8bae\u9884\u5148\u8bc4\u4f30\u8f6c\u6362\u6548\u679c\uff0c\u5fc5\u8981\u65f6\u8003\u8651\u9884\u5904\u7406\u6216\u66ff\u4ee3\u65b9\u6848\u3002<\/li>\n\n\n\n<li><strong>\u5bf9\u4e8e\u4e2d\u6587\u5185\u5bb9<\/strong>\uff1a\u5efa\u8bae\u5728 Linux\/Docker \u73af\u5883\u4e2d\u4f7f\u7528\u00a0<code class=\"\">RegisterFont<\/code>\u00a0\u6ce8\u518c Noto Sans CJK \u5b57\u4f53\u3002<\/li>\n\n\n\n<li><strong>\u5bf9\u4e8e\u8d85\u957f\u6587\u672c\u5355\u5143\u683c<\/strong>\uff1a\u5f53\u524d\u7248\u672c\u5b58\u5728\u622a\u65ad\u95ee\u9898\uff0c\u53ef\u5728\u751f\u6210 Excel \u65f6\u9884\u5148\u8bbe\u7f6e\u81ea\u52a8\u6362\u884c\u6216\u9002\u5f53\u7684\u5217\u5bbd\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-43\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">11. \u6027\u80fd\u4e0e\u57fa\u51c6\u6d4b\u8bd5<\/h2>\n\n\n\n<span id=\"h3-44\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">11.1 \u5b98\u65b9\u6d4b\u8bd5\u7ed3\u679c<\/h3>\n\n\n\n<p>\u7ecf\u8fc7&nbsp;<strong>373 \u4e2a\u6d4b\u8bd5\u7528\u4f8b<\/strong>\uff08\u4e0e MiniExcel \/ Office 365 \u8f93\u51fa\u5bf9\u6bd4\uff09\u7684\u8bc4\u4f30\uff1a<\/p>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u6587\u6863\u7c7b\u578b<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u7528\u4f8b\u6570<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\ud83d\udfe2 \u4f18\u79c0\uff08\u226590%\uff09<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\ud83d\udfe1 \u53ef\u63a5\u53d7\uff0870%~90%\uff09<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\ud83d\udd34 \u5f85\u6539\u8fdb\uff08&lt;70%\uff09<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u5e73\u5747\u5206<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">XLSX \u8f6c PDF<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">191<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">175<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">16<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">0<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\"><strong>96.9%<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">DOCX \u8f6c PDF<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">180<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">178<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">2<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">0<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\"><strong>97.6%<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Issue \u6587\u4ef6<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">2<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">1<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">1<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">0<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">83.8%<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\"><strong>\u5408\u8ba1<\/strong><\/td>\n<td class=\"has-text-align-center\" data-align=\"center\"><strong>373<\/strong><\/td>\n<td class=\"has-text-align-center\" data-align=\"center\"><strong>354<\/strong><\/td>\n<td class=\"has-text-align-center\" data-align=\"center\"><strong>19<\/strong><\/td>\n<td class=\"has-text-align-center\" data-align=\"center\"><strong>0<\/strong><\/td>\n<td class=\"has-text-align-center\" data-align=\"center\"><strong>97.2%<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u8bc4\u5206\u7ef4\u5ea6<\/strong>\uff1a\u6587\u672c\u76f8\u4f3c\u5ea6 40% + \u89c6\u89c9\u76f8\u4f3c\u5ea6 40% + \u9875\u6570 20%<\/p>\n<\/blockquote>\n\n\n\n<span id=\"h3-45\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">11.2 \u6027\u80fd\u7279\u70b9<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8f6c\u6362\u901f\u5ea6\u5feb\uff0c\u65e0\u9700\u542f\u52a8\u5916\u90e8\u8fdb\u7a0b<\/li>\n\n\n\n<li>\u5185\u5b58\u5360\u7528\u5c0f\uff0c\u9002\u5408\u9ad8\u5e76\u53d1\u573a\u666f<\/li>\n\n\n\n<li>\u4e0d\u4ea7\u751f\u4e34\u65f6\u6587\u4ef6\uff08\u4f7f\u7528\u5185\u5b58\u6d41\u65f6\uff09<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-46\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">12. \u5e38\u89c1\u95ee\u9898 FAQ<\/h2>\n\n\n\n<span id=\"h3-47\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q1\uff1a\u751f\u6210\u7684 PDF \u4e2d\u6587\u663e\u793a\u4e3a\u65b9\u5757\u6216\u4e71\u7801\uff1f<\/h3>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1a\u5f53\u524d\u8fd0\u884c\u73af\u5883\uff08\u5bb9\u5668\u3001Linux\uff09\u7f3a\u5c11\u4e2d\u6587\u5b57\u4f53\u3002<\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ \u7a0b\u5e8f\u542f\u52a8\u65f6\u6ce8\u518c\u4e2d\u6587\u5b57\u4f53<\/em>\nMiniPdf.RegisterFont(\"NotoSansSC\", \n    File.ReadAllBytes(\"Fonts\/NotoSansSC-Regular.ttf\"));\n<\/code><\/pre>\n\n\n\n<p>\u6216\u5728 Dockerfile \u4e2d\u5b89\u88c5\u7cfb\u7edf\u5b57\u4f53\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RUN apt-get update &amp;&amp; apt-get install -y fonts-noto-cjk\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-48\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q2\uff1aExcel \u4e2d\u7684\u56fe\u8868\u6ca1\u6709\u6b63\u786e\u663e\u793a\uff1f<\/h3>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1aMiniPdf \u5bf9\u590d\u6742\u56fe\u8868\u7684\u6e32\u67d3\u652f\u6301\u6709\u9650\uff0c\u5f53\u524d\u7248\u672c\u5c06\u56fe\u8868\u6e32\u67d3\u4e3a\u7b80\u5316\u77e2\u91cf\u8fd1\u4f3c\u56fe\u3002<\/p>\n\n\n\n<p><strong>\u5efa\u8bae<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5bf9\u4e8e\u5fc5\u987b\u7cbe\u786e\u8fd8\u539f\u56fe\u8868\u7684\u573a\u666f\uff0c\u53ef\u8003\u8651\u5c06\u56fe\u8868\u53e6\u5b58\u4e3a\u56fe\u7247\u540e\u63d2\u5165 Excel\uff0c\u518d\u8fdb\u884c\u8f6c\u6362\u3002<\/li>\n\n\n\n<li>\u5173\u6ce8 GitHub Issues \u83b7\u53d6\u540e\u7eed\u7248\u672c\u7684\u56fe\u8868\u652f\u6301\u8fdb\u5c55\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-49\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q3\uff1a\u5355\u5143\u683c\u957f\u6587\u672c\u88ab\u622a\u65ad\u600e\u4e48\u529e\uff1f<\/h3>\n\n\n\n<p><strong>\u539f\u56e0<\/strong>\uff1a\u5df2\u77e5\u7f3a\u9677\uff0c\u8d85\u51fa\u5217\u5bbd\u7684\u6587\u672c\u4f1a\u88ab\u622a\u65ad\u800c\u975e\u81ea\u52a8\u6362\u884c\u3002<\/p>\n\n\n\n<p><strong>\u4e34\u65f6\u89e3\u51b3\u65b9\u6848<\/strong>\uff1a\u5728\u751f\u6210 Excel \u65f6\uff0c\u9884\u5148\u8bbe\u7f6e\u5355\u5143\u683c\u7684\u81ea\u52a8\u6362\u884c\u5c5e\u6027\uff0c\u5e76\u9002\u5f53\u589e\u5927\u5217\u5bbd\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-50\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q4\uff1a\u5982\u4f55\u5728 ASP.NET Core \u4e2d\u6ce8\u518c\u5b57\u4f53\uff08\u4e0d\u91cd\u590d\u6ce8\u518c\uff09\uff1f<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/\/ Program.cs - \u4f7f\u7528\u5355\u6b21\u521d\u59cb\u5316<\/em>\nvar fontsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, \"Fonts\");\nif (Directory.Exists(fontsPath))\n{\n    foreach (var ttf in Directory.GetFiles(fontsPath, \"*.ttf\"))\n    {\n        MiniPdf.RegisterFont(Path.GetFileNameWithoutExtension(ttf), \n                              File.ReadAllBytes(ttf));\n    }\n}\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-51\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q5\uff1a\u652f\u6301\u5f02\u6b65\u8f6c\u6362\u5417\uff1f<\/h3>\n\n\n\n<p>\u5f53\u524d&nbsp;<code class=\"\">ConvertToPdf<\/code>&nbsp;\u65b9\u6cd5\u4e3a\u540c\u6b65\u65b9\u6cd5\u3002\u5728 Web \u573a\u666f\u4e2d\uff0c\u53ef\u4f7f\u7528&nbsp;<code class=\"\">Task.Run<\/code>&nbsp;\u5305\u88c5\u4e3a\u5f02\u6b65\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>byte&#91;] pdfBytes = await Task.Run(() =&gt; MiniPdf.ConvertToPdf(inputStream));\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-52\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q6\uff1a\u662f\u5426\u652f\u6301\u52a0\u5bc6\/\u5bc6\u7801\u4fdd\u62a4\u7684 PDF\uff1f<\/h3>\n\n\n\n<p>\u5f53\u524d\u7248\u672c\u4e0d\u652f\u6301\u751f\u6210\u52a0\u5bc6 PDF\u3002\u5982\u9700\u6b64\u529f\u80fd\uff0c\u53ef\u5728 MiniPdf \u8f6c\u6362\u540e\u4f7f\u7528\u5176\u4ed6\u5e93\uff08\u5982 iTextSharp\uff09\u5bf9 PDF \u8fdb\u884c\u52a0\u5bc6\u5904\u7406\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h3-53\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h3 class=\"wp-block-heading\">Q7\uff1a\u4e0e\u5176\u4ed6 PDF \u5e93\u76f8\u6bd4\u6709\u54ea\u4e9b\u4e0d\u540c\uff1f<\/h3>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u7279\u6027<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">MiniPdf<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">iTextSharp<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">Aspose.PDF<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">LibreOffice<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td class=\"has-text-align-center\" data-align=\"center\">\u5f00\u6e90\u514d\u8d39\u5546\u7528<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u26a0\ufe0f AGPL<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u274c \u5546\u4e1a\u6388\u6743<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<\/tr>\n<tr>\n<td class=\"has-text-align-center\" data-align=\"center\">\u96f6\u4f9d\u8d56<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u274c \u9700\u5b89\u88c5<\/td>\n<\/tr>\n<tr>\n<td class=\"has-text-align-center\" data-align=\"center\">Office \u76f4\u63a5\u8f6c\u6362<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u274c<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<\/tr>\n<tr>\n<td class=\"has-text-align-center\" data-align=\"center\">\u4e2d\u6587\u652f\u6301<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u26a0\ufe0f \u9700\u5b57\u4f53<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705<\/td>\n<\/tr>\n<tr>\n<td class=\"has-text-align-center\" data-align=\"center\">\u590d\u6742\u6392\u7248\u4fdd\u771f\u5ea6<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u26a0\ufe0f \u4e00\u822c<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">&#8211;<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705 \u9ad8<\/td>\n<td class=\"has-text-align-center\" data-align=\"center\">\u2705 \u9ad8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-54\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">13. \u76f8\u5173\u8d44\u6e90<\/h2>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u8d44\u6e90<\/th>\n<th style=\"text-align: center;\">\u94fe\u63a5<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td style=\"text-align: center;\">GitHub \u4ed3\u5e93<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/github.com\/mini-software\/MiniPdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/mini-software\/MiniPdf<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Gitee \u955c\u50cf<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/gitee.com\/dotnetchina\/MiniPdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/gitee.com\/dotnetchina\/MiniPdf<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">NuGet \u5305<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/www.nuget.org\/packages\/MiniPdf\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.nuget.org\/packages\/MiniPdf\/<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5728\u7ebf\u6f14\u793a<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/mini-software.github.io\/MiniPdf\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/mini-software.github.io\/MiniPdf\/<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u5b98\u65b9\u535a\u5ba2\u4ecb\u7ecd<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/www.cnblogs.com\/ITWeiHan\/p\/19786846\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.cnblogs.com\/ITWeiHan\/p\/19786846<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">\u6280\u672f\u6587\u6863\uff08DeepWiki\uff09<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/deepwiki.com\/mini-software\/MiniPdf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/deepwiki.com\/mini-software\/MiniPdf<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">GitHub Releases\uff08CLI \u4e8c\u8fdb\u5236\uff09<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/github.com\/shps951023\/MiniPdf\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/shps951023\/MiniPdf\/releases<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">Discord \u793e\u533a<\/td>\n<td style=\"text-align: center;\"><a href=\"https:\/\/discord.gg\/BUGRRthp\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/discord.gg\/BUGRRthp<\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">QQ \u4ea4\u6d41\u7fa4<\/td>\n<td style=\"text-align: center;\">813100564 \/ 579033769 \/ 625362917 \/ 907750429<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<span id=\"h2-55\" class=\"heading-anchor\" aria-hidden=\"true\"><\/span><h2 class=\"wp-block-heading\">\u7248\u672c\u5386\u53f2<\/h2>\n\n\n<figure class=\"wp-block-table is-style-stripes\">\n<table class=\"has-fixed-layout\">\n<thead>\n<tr>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u7248\u672c<\/th>\n<th class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">\u53d1\u5e03\u65e5\u671f<\/th>\n<th style=\"text-align: center;\">\u4e3b\u8981\u66f4\u65b0<\/th>\n<\/tr>\n<\/thead>\n<tbody style=\"display: table-row-group;\">\n<tr>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">0.16.0<\/td>\n<td class=\"has-text-align-center\" style=\"text-align: center;\" data-align=\"center\">2026-03-17<\/td>\n<td style=\"text-align: center;\">\u5f53\u524d\u6700\u65b0\u7248\uff0c\u652f\u6301 .docx \u8f6c PDF\uff0cNative AOT \u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\ud83d\udccc&nbsp;<strong>\u63d0\u793a<\/strong>\uff1aMiniPdf \u76ee\u524d\u5904\u4e8e Beta \u72b6\u6001\uff0c\u529f\u80fd\u4ecd\u5728\u6301\u7eed\u5b8c\u5584\u4e2d\u3002\u5982\u9047\u5230\u95ee\u9898\uff0c\u6b22\u8fce\u5728&nbsp;<a href=\"https:\/\/github.com\/mini-software\/MiniPdf\/issues\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub Issues<\/a>&nbsp;\u63d0\u4ea4\u53cd\u9988\uff0c\u6216\u52a0\u5165\u793e\u533a\u7fa4\u4ea4\u6d41\u3002<\/p>\n\n\n\n<p><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u7248\u672c\uff1a\u9002\u7528\u4e8e MiniPdf 0.16.0 \u53ca\u4ee5\u4e0a\u7248\u672c\u8bb8\u53ef\u534f\u8bae\uff1aApache 2.0\uff0c\u5f00\u6e90\u53ef\u514d\u8d39\u5546\u7528\u5b98\u65b9\u4ed3\u5e93\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":479,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[28,29,54],"class_list":["post-585","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hd","tag-net","tag-pdf","tag-54"],"_links":{"self":[{"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/posts\/585","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hyw.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=585"}],"version-history":[{"count":29,"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/posts\/585\/revisions\/622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hyw.life\/index.php?rest_route=\/wp\/v2\/media\/479"}],"wp:attachment":[{"href":"https:\/\/www.hyw.life\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hyw.life\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=585"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hyw.life\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}