IronPDF トラブルシューティング Blazorサーバー / WebAssembly (WASM) BlazorサーバーとWebAssemblyの比較:比較 カーティス・チャウ 更新日:2025年6月1日 IronPDF をダウンロード NuGet ダウンロード DLL ダウンロード Windows 版 無料トライアル LLM向けのコピー LLM向けのコピー LLM 用の Markdown としてページをコピーする ChatGPTで開く このページについてChatGPTに質問する ジェミニで開く このページについてGeminiに問い合わせる Grokで開く このページについてGrokに質問する 困惑の中で開く このページについてPerplexityに問い合わせる 共有する Facebook で共有 Xでシェア(Twitter) LinkedIn で共有 URLをコピー 記事をメールで送る This article was translated from English: Does it need improvement? Translated View the article in English IronPDFはBlazor ServerとBlazor WebAssembly (WASM)をサポートしていますか? IronPDFはBlazor Serverをサポートしていますが、Blazor WebAssembly (WASM)はサポートしていません。 Blazor ServerでPDFを保存するには、PDFドキュメントストリームをバイト配列に変換し、その後JavaScript関数に渡してダウンロードを促します。 Blazor ServerアプリケーションでPDFドキュメントをバイト配列に変換し、JavaScriptでダウンロードをトリガーする方法の例を以下に示します。 @page "/pdfdownload" @inject IJSRuntime JSRuntime @* A button to download the PDF *@ <button @onclick="DownloadPDF">Download PDF</button> @code { private async Task DownloadPDF() { // Create a PDF document using IronPDF (this is hypothetical code) var renderer = new IronPdf.HtmlToPdf(); var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>"); // Convert PDF document to a byte array byte[] pdfBytes = pdfDocument.BinaryData; // Call the JavaScript function to download the PDF await JSRuntime.InvokeVoidAsync("downloadFile", pdfBytes, "example.pdf"); } } @page "/pdfdownload" @inject IJSRuntime JSRuntime @* A button to download the PDF *@ <button @onclick="DownloadPDF">Download PDF</button> @code { private async Task DownloadPDF() { // Create a PDF document using IronPDF (this is hypothetical code) var renderer = new IronPdf.HtmlToPdf(); var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>"); // Convert PDF document to a byte array byte[] pdfBytes = pdfDocument.BinaryData; // Call the JavaScript function to download the PDF await JSRuntime.InvokeVoidAsync("downloadFile", pdfBytes, "example.pdf"); } } $vbLabelText $csharpLabel PDFダウンロードを処理するための対応するJavaScript関数を以下に示します。 _Host.cshtml または index.html ファイルにこれを必ず含めてください: <script> // Function to download a file from a byte array in JavaScript function downloadFile(fileBytes, fileName) { // Convert byte array to a Blob const blob = new Blob([fileBytes], { type: 'application/pdf' }); // Create a link element for downloading the file const link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); link.download = fileName; // Append the link to the body, trigger it, and remove it afterwards document.body.appendChild(link); // Required for Firefox link.click(); document.body.removeChild(link); } </script> <script> // Function to download a file from a byte array in JavaScript function downloadFile(fileBytes, fileName) { // Convert byte array to a Blob const blob = new Blob([fileBytes], { type: 'application/pdf' }); // Create a link element for downloading the file const link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); link.download = fileName; // Append the link to the body, trigger it, and remove it afterwards document.body.appendChild(link); // Required for Firefox link.click(); document.body.removeChild(link); } </script> JAVASCRIPT 主なポイント: Blazor Serverはサーバーサイド操作を可能にし、C#コードをサーバー上で直接実行できます。 Blazor WebAssemblyはクライアントサイドで動作し、IronPDFのようなサーバーサイドリソースに直接アクセスすることはできません。 Blazor Serverの完全なチュートリアルは私たちのウェブサイトでご覧いただけます: Blazor Server Tutorial カーティス・チャウ 今すぐエンジニアリングチームとチャット テクニカルライター Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。 準備はできましたか? Nuget ダウンロード 17,803,474 | バージョン: 2026.3 リリース 無料トライアル NuGet 無料版 総ダウンロード数: 17,803,474 ライセンスを見る まだスクロールしていますか? すぐに証拠が欲しいですか? PM > Install-Package IronPdf サンプルを実行するHTML が PDF に変換されるのを確認します。 NuGet 無料版 総ダウンロード数: 17,803,474 ライセンスを見る