IRONPDF 사용 How to Create a Blazor PDF Viewer: Server-Side PDF Generation Made Simple 커티스 차우 게시됨:1월 21, 2026 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 Creating a Blazor PDF viewer in Blazor Server applications is a common need for business applications that display invoices, reports, and documents in the browser. This guide explains how to set up a fully functional PDF viewer in Blazor using IronPDF. It allows you to generate, customize, and open PDF files within your Blazor project effortlessly. Unlike third-party browser tools, IronPDF makes it easy to create a powerful PDF viewer with built-in tools like zoom, navigation, text selection, and printing. Developers can also add features such as form filling, annotations, and counterclockwise switch orientation for rotating loaded PDF documents. Get started with IronPDF today and transform how your Blazor applications handle PDF documents. How Do I Set Up IronPDF in a Blazor Server Project? Getting started with IronPDF in your Blazor Server PDF viewer project requires just a few steps. First, install the IronPDF NuGet package using the Package Manager Console: Install-Package IronPdf Alternatively, you can use the NuGet Package Manager UI to search for "IronPdf" and select the latest version. NuGet을 사용하여 설치하세요 PM > Install-Package IronPdf 빠른 설치를 원하시면 NuGet 에서 https://www.NuGet.org/packages/IronPdf를 검색해 보세요. 1천만 건 이상의 다운로드를 기록하며 C#을 이용한 PDF 개발 방식을 혁신하고 있습니다. DLL 파일 이나 윈도우 설치 프로그램을 다운로드할 수도 있습니다. After installation, add your license key to the Program.cs file to unlock full functionality: // Program.cs IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY-HERE"; // Program.cs IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY-HERE"; $vbLabelText $csharpLabel For development and testing, IronPDF works without a license key but adds a watermark to generated PDFs. You can get a free trial license to remove the watermark during development. IronPDF supports both Blazor Server and Blazor WebAssembly apps, so you can add PDF generation and viewing to desktop, mobile apps, or even .NET MAUI projects. How Can I Display a PDF File from a URL in Blazor? The most straightforward way to create a PDF viewer in Blazor is by converting a URL to a PDF and displaying it in an iframe. IronPDF's ChromePdfRenderer class handles the conversion using its Chrome rendering engine, maintaining all styling and JavaScript functionality from the original webpage. Here's a complete Razor component that renders a URL as a PDF: @page "/pdfviewer" @using IronPdf <h3>PDF Viewer</h3> <button @onclick="GeneratePdf" class="btn btn-primary">Load PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GeneratePdf() { var renderer = new ChromePdfRenderer(); // Convert URL to PDF var pdf = await renderer.RenderUrlAsPdfAsync("https://ironpdf.com"); // Convert to base64 and create data URI for iframe display var base64String = Convert.ToBase64String(pdf.BinaryData); pdfDataUri = $"data:application/pdf;base64,{base64String}"; } } @page "/pdfviewer" @using IronPdf <h3>PDF Viewer</h3> <button @onclick="GeneratePdf" class="btn btn-primary">Load PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GeneratePdf() { var renderer = new ChromePdfRenderer(); // Convert URL to PDF var pdf = await renderer.RenderUrlAsPdfAsync("https://ironpdf.com"); // Convert to base64 and create data URI for iframe display var base64String = Convert.ToBase64String(pdf.BinaryData); pdfDataUri = $"data:application/pdf;base64,{base64String}"; } } $vbLabelText $csharpLabel The RenderUrlAsPdfAsync method fetches the webpage content, converts it into the PDF format, and renders it in your Blazor PDF viewer component. This approach works across desktop and mobile phones, with a built-in toolbar for navigating, zooming, and printing PDFs. The loaded PDF document should appear similar to how it is in the following output image: How Do I Customize PDF Generation? IronPDF provides extensive customization options through the ChromePdfRenderOptions class for your Blazor PDF viewer component. You can add headers, footers, adjust margins, and control page layout to create professional-looking documents. Learn more about rendering options in the documentation. @page "/pdfcustom" @using IronPdf <h3>Customized PDF Viewer</h3> <button @onclick="GenerateCustomizedPdf" class="btn btn-primary">Generate Customized PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GenerateCustomizedPdf() { var renderer = new ChromePdfRenderer(); // Assign rendering options to the renderer renderer.RenderingOptions = new ChromePdfRenderOptions { PaperSize = IronPdf.Rendering.PdfPaperSize.A4, MarginTop = 25, MarginBottom = 25, MarginLeft = 20, MarginRight = 20, // Add header with title TextHeader = new TextHeaderFooter { CenterText = "Monthly Report - {date}", FontSize = 12 }, // Add footer with page numbers TextFooter = new TextHeaderFooter { LeftText = "Confidential", RightText = "Page {page} of {total-pages}", FontSize = 10 } }; // Now generate with options applied var pdf = await renderer.RenderUrlAsPdfAsync("https://example.com/report"); // Display in iframe pdfDataUri = $"data:application/pdf;base64,{Convert.ToBase64String(pdf.BinaryData)}"; } } @page "/pdfcustom" @using IronPdf <h3>Customized PDF Viewer</h3> <button @onclick="GenerateCustomizedPdf" class="btn btn-primary">Generate Customized PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GenerateCustomizedPdf() { var renderer = new ChromePdfRenderer(); // Assign rendering options to the renderer renderer.RenderingOptions = new ChromePdfRenderOptions { PaperSize = IronPdf.Rendering.PdfPaperSize.A4, MarginTop = 25, MarginBottom = 25, MarginLeft = 20, MarginRight = 20, // Add header with title TextHeader = new TextHeaderFooter { CenterText = "Monthly Report - {date}", FontSize = 12 }, // Add footer with page numbers TextFooter = new TextHeaderFooter { LeftText = "Confidential", RightText = "Page {page} of {total-pages}", FontSize = 10 } }; // Now generate with options applied var pdf = await renderer.RenderUrlAsPdfAsync("https://example.com/report"); // Display in iframe pdfDataUri = $"data:application/pdf;base64,{Convert.ToBase64String(pdf.BinaryData)}"; } } $vbLabelText $csharpLabel The template variables, such as {page}, {total-pages}, and {date}, are automatically replaced with actual values during PDF generation in your Blazor PDF viewer. You can also use the HtmlHeader and HtmlFooter properties for more complex layouts with HTML content. This ensures your Blazor PDF viewer can render high-performance documents with proper layout, branding, and form fields where needed. For detailed header and footer customization, see the headers and footers guide. What's the Best Way to Enable PDF Downloads? While displaying PDFs in Blazor using an iframe works well for viewing, users often need to download the document. You can implement this using JavaScript InterOp to trigger a browser download. For more download options, see our export and save PDF guide: @page "/pdfdownload" @using IronPdf @inject IJSRuntime JSRuntime <h3>Download PDF</h3> <button @onclick="DownloadPdf" class="btn btn-success">Download PDF</button> @code { private async Task DownloadPdf() { var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Invoice</h1><p>Total: $1,299</p>"); using var streamRef = new DotNetStreamReference(stream: new MemoryStream(pdf.BinaryData)); await JSRuntime.InvokeVoidAsync("downloadFileFromStream", "invoice.pdf", streamRef); } } @page "/pdfdownload" @using IronPdf @inject IJSRuntime JSRuntime <h3>Download PDF</h3> <button @onclick="DownloadPdf" class="btn btn-success">Download PDF</button> @code { private async Task DownloadPdf() { var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Invoice</h1><p>Total: $1,299</p>"); using var streamRef = new DotNetStreamReference(stream: new MemoryStream(pdf.BinaryData)); await JSRuntime.InvokeVoidAsync("downloadFileFromStream", "invoice.pdf", streamRef); } } $vbLabelText $csharpLabel Add this JavaScript function to your _Host.cshtml file (as discussed in Microsoft's Blazor JavaScript InterOp documentation): <script> window.downloadFileFromStream = async (fileName, contentStreamReference) => { const arrayBuffer = await contentStreamReference.arrayBuffer(); const blob = new Blob([arrayBuffer]); const url = URL.createObjectURL(blob); const anchorElement = document.createElement('a'); anchorElement.href = url; anchorElement.download = fileName ?? ''; anchorElement.click(); anchorElement.remove(); URL.revokeObjectURL(url); } </script> <script> window.downloadFileFromStream = async (fileName, contentStreamReference) => { const arrayBuffer = await contentStreamReference.arrayBuffer(); const blob = new Blob([arrayBuffer]); const url = URL.createObjectURL(blob); const anchorElement = document.createElement('a'); anchorElement.href = url; anchorElement.download = fileName ?? ''; anchorElement.click(); anchorElement.remove(); URL.revokeObjectURL(url); } </script> $vbLabelText $csharpLabel How Can I Generate PDFs from Razor Components? One of the most powerful features for displaying PDFs in Blazor is generating PDFs directly from HTML content, including dynamic data. This approach is perfect for creating invoices, reports, or any data-driven documents. Check out our guide on HTML to PDF conversion for more advanced techniques: @page "/invoicedemo" @using IronPdf <h3>Invoice Generator</h3> <button @onclick="GenerateInvoice" class="btn btn-primary">Generate Invoice PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GenerateInvoice() { var invoiceHtml = $@" <html> <head> <style> body {{ font-family: Arial, sans-serif; }} .header {{ background-color: #f0f0f0; padding: 20px; }} .invoice-table {{ width: 100%; border-collapse: collapse; }} .invoice-table th, .invoice-table td {{ border: 1px solid #ddd; padding: 8px; }} .total {{ font-weight: bold; font-size: 18px; }} </style> </head> <body> <div class='header'> <h1>Invoice #INV-2024-001</h1> <p>Date: {DateTime.Now:MM/dd/yyyy}</p> </div> <table class='invoice-table'> <thead> <tr> <th>Item</th> <th>Quantity</th> <th>Price</th> <th>Total</th> </tr> </thead> <tbody> <tr> <td>IronPDF License</td> <td>1</td> <td>$799</td> <td>$799</td> </tr> <tr> <td>Priority Support</td> <td>1</td> <td>$250</td> <td>$250</td> </tr> </tbody> </table> <p class='total'>Total Amount: $1,199</p> </body> </html>"; var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlAsPdfAsync(invoiceHtml); pdfDataUri = $"data:application/pdf;base64,{Convert.ToBase64String(pdf.BinaryData)}"; } } @page "/invoicedemo" @using IronPdf <h3>Invoice Generator</h3> <button @onclick="GenerateInvoice" class="btn btn-primary">Generate Invoice PDF</button> @if (!string.IsNullOrEmpty(pdfDataUri)) { <iframe src="@pdfDataUri" style="width:100%; height:600px; border:1px solid #ccc; margin-top:20px;"></iframe> } @code { private string pdfDataUri = string.Empty; private async Task GenerateInvoice() { var invoiceHtml = $@" <html> <head> <style> body {{ font-family: Arial, sans-serif; }} .header {{ background-color: #f0f0f0; padding: 20px; }} .invoice-table {{ width: 100%; border-collapse: collapse; }} .invoice-table th, .invoice-table td {{ border: 1px solid #ddd; padding: 8px; }} .total {{ font-weight: bold; font-size: 18px; }} </style> </head> <body> <div class='header'> <h1>Invoice #INV-2024-001</h1> <p>Date: {DateTime.Now:MM/dd/yyyy}</p> </div> <table class='invoice-table'> <thead> <tr> <th>Item</th> <th>Quantity</th> <th>Price</th> <th>Total</th> </tr> </thead> <tbody> <tr> <td>IronPDF License</td> <td>1</td> <td>$799</td> <td>$799</td> </tr> <tr> <td>Priority Support</td> <td>1</td> <td>$250</td> <td>$250</td> </tr> </tbody> </table> <p class='total'>Total Amount: $1,199</p> </body> </html>"; var renderer = new ChromePdfRenderer(); var pdf = await renderer.RenderHtmlAsPdfAsync(invoiceHtml); pdfDataUri = $"data:application/pdf;base64,{Convert.ToBase64String(pdf.BinaryData)}"; } } $vbLabelText $csharpLabel This method gives you complete control over the PDF content and styling in your Blazor PDF viewer, allowing you to create pixel-perfect documents from your application data. For more complex HTML rendering scenarios, explore our HTML to PDF tutorials. What Other PDF Operations Can I Perform? IronPDF offers many other tools and extensions beyond basic viewing: Merging PDF pages into a single document Adding annotations and editing features Applying password protection and security Enabling upload and dynamically creating table reports Each of these extends the overview of what’s possible in a Blazor PDF viewer component, giving developers complete control over data, project workflows, and example applications. For more detailed information on these features, check out the guides on merging PDFs, watermarking, and PDF security. Conclusion You now have the foundation for implementing a PDF viewer in your Blazor Server application using IronPDF. From basic URL rendering to dynamic component-based generation, IronPDF provides the tools needed to handle PDF requirements in modern web applications. For additional Blazor development resources, consider exploring Microsoft's official Blazor documentation. The combination of IronPDF's Chrome rendering engine and Blazor's component model creates a powerful solution for generating and displaying professional PDF documents directly in the browser, eliminating the need for external PDF viewers or plugins. Ready to implement PDF functionality in your Blazor application? Start your free trial to find the perfect fit for your project. 자주 묻는 질문 Blazor PDF 뷰어란 무엇인가요? Blazor PDF 뷰어는 브라우저에서 송장, 보고서 및 기타 파일과 같은 PDF 문서를 직접 표시하기 위해 Blazor Server 애플리케이션에서 사용되는 구성 요소입니다. Blazor 애플리케이션에서 PDF 뷰어를 구현하려면 어떻게 해야 하나요? Blazor 프로젝트 내에서 PDF 파일을 손쉽게 생성, 사용자 지정 및 열 수 있는 IronPDF를 사용하여 Blazor 애플리케이션에서 PDF 뷰어를 구현할 수 있습니다. Blazor PDF 뷰어에 IronPDF를 사용해야 하는 이유는 무엇인가요? IronPDF는 Blazor 애플리케이션에 PDF 보기 기능을 통합하는 강력한 솔루션으로, PDF 파일을 쉽게 생성 및 사용자 지정하고 사용자 경험을 개선하며 문서 처리를 간소화할 수 있습니다. Blazor 애플리케이션에서 PDF 뷰어를 사용하면 어떤 이점이 있나요? Blazor 애플리케이션에서 PDF 뷰어를 사용하면 사용자가 브라우저에서 직접 문서를 볼 수 있어 사용자 경험이 향상됩니다. 특히 송장이나 보고서와 같은 비즈니스 문서를 표시하는 데 유용합니다. IronPDF는 Blazor 애플리케이션에서 PDF 생성을 처리할 수 있나요? 예, IronPDF는 Blazor 애플리케이션에서 PDF 생성을 처리할 수 있으므로 다양한 비즈니스 요구 사항을 충족하는 PDF 문서를 원활하게 생성하고 사용자 지정할 수 있습니다. Blazor에서 IronPDF를 사용하여 PDF 파일을 사용자 지정할 수 있나요? 물론 IronPDF는 Blazor 애플리케이션에서 PDF 파일에 대한 광범위한 사용자 지정 옵션을 제공하여 개발자가 특정 요구 사항에 따라 문서를 맞춤화할 수 있도록 지원합니다. Blazor PDF 뷰어를 사용하여 표시할 수 있는 문서 유형은 무엇인가요? Blazor PDF 뷰어는 송장, 보고서 및 PDF 형식으로 변환할 수 있는 기타 모든 문서를 포함한 다양한 문서를 표시할 수 있습니다. IronPDF는 Blazor 프로젝트에서 PDF 파일 열기를 지원하나요? 예, IronPDF는 Blazor 프로젝트 내에서 PDF 파일 열기를 지원하므로 브라우저에서 직접 PDF 문서를 쉽게 보고 관리할 수 있습니다. Blazor PDF 뷰어의 사용자 경험은 어떤가요? 사용자가 웹 브라우저 내에서 PDF 문서를 쉽게 보고 상호 작용할 수 있어 원활하고 효율적인 문서 처리 프로세스를 제공하므로 Blazor PDF 뷰어의 사용자 경험이 향상됩니다. IronPDF는 Blazor PDF 뷰어 프로젝트용 .NET 10과 호환되나요? 예-IronPDF는 .NET 10과 완벽하게 호환됩니다. 모든 최신 .NET 버전(10, 9, 8, 7, 6, 코어, 프레임워크)을 지원하며 특별한 구성 없이도 .NET 10 아래의 Blazor 웹 앱에서 작동합니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다. 커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다. 관련 기사 업데이트됨 1월 22, 2026 How to Create PDF Documents in .NET with IronPDF: Complete Guide Discover effective methods to create PDF files in C# for developers. Enhance your coding skills and streamline your projects. Read the article now! 더 읽어보기 업데이트됨 1월 21, 2026 How to Merge PDF Files in VB.NET: Complete Tutorial Merge PDF VB NET with IronPDF. Learn to combine multiple PDF files into one document using simple VB.NET code. Step-by-step examples included. 더 읽어보기 업데이트됨 1월 21, 2026 C# PDFWriter Tutorial: Create PDF Documents in .NET Learn to create PDFs efficiently using C# PDFWriter with this step-by-step guide for developers. Read the article to enhance your skills today! 더 읽어보기 How to Read Data from PDF Files in ASP.NET CoreHow to Create a PDF Viewer in ASP.N...
업데이트됨 1월 22, 2026 How to Create PDF Documents in .NET with IronPDF: Complete Guide Discover effective methods to create PDF files in C# for developers. Enhance your coding skills and streamline your projects. Read the article now! 더 읽어보기
업데이트됨 1월 21, 2026 How to Merge PDF Files in VB.NET: Complete Tutorial Merge PDF VB NET with IronPDF. Learn to combine multiple PDF files into one document using simple VB.NET code. Step-by-step examples included. 더 읽어보기
업데이트됨 1월 21, 2026 C# PDFWriter Tutorial: Create PDF Documents in .NET Learn to create PDFs efficiently using C# PDFWriter with this step-by-step guide for developers. Read the article to enhance your skills today! 더 읽어보기