IRONPDF 사용 How to view PDF files in ASP.NET using C# and IronPDF 커티스 차우 업데이트됨:7월 28, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 Most people open PDFs on a computer using a dedicated desktop application, but software engineers can also use IronPDF to create, view, open, read, and edit PDF content with C# programmatically. IronPDF turned out to be a very useful plugin when reading PDF files in ASP.NET and C#. You can download the ASP.NET PDF demonstration project. It is possible to create PDF documents quickly and easily using C# with IronPDF. Much of the design and layout of PDF documents can be accomplished by using existing HTML assets or by delegating the task to web design employees; it takes care of the time-consuming task of integrating PDF generation into your application, and it automates converting prepared documents into PDFs. With .NET, you can: Convert web forms, local HTML pages, and other websites to PDF format. Allow users to download documents, share them with others via email, or save them in the cloud. Invoice customers and provide quotations; prepare reports; negotiate contracts and other paperwork. Work with ASP.NET, ASP.NET Core, Web Forms, MVC, Web APIs on .NET Framework and .NET Core, and other programming languages. Setting up IronPDF Library There are two ways to install the library; Installing with the NuGet Package Manager IronPDF can be installed via the Visual Studio Add-in or the NuGet Package Manager from the command line. Navigate to the Console, type in the following command in Visual Studio: Install-Package IronPdf Download the DLL File Directly From the Website Alternatively, you can get the DLL straight from the website. Remember to include the following directive at the top of any cs class file that makes use of IronPDF: using IronPdf; using IronPdf; $vbLabelText $csharpLabel Check out IronPDF Detailed Features Overview. IronPDF is a must-have plugin. Get yours now and try it with IronPDF NuGet Package. Create a PDF File From an HTML String in .NET C# Creating a PDF file from an HTML string in C# is an efficient and rewarding method of creating a new PDF file in C#. The RenderHtmlAsPdf function from a ChromePdfRenderer provides an easy way to convert any HTML (HTML5) string into a PDF document, thanks to the embedded version of the Google Chromium engine in the IronPDF DLL. // Create a renderer to convert HTML to PDF var renderer = new ChromePdfRenderer(); // Convert an HTML string to a PDF using var renderedPdf = renderer.RenderHtmlAsPdf("<h1>My First HTML to Pdf</h1>"); // Define the output path for the PDF var outputPath = "My_First_Html.pdf"; // Save the rendered PDF to the specified path renderedPdf.SaveAs(outputPath); // Automatically open the newly created PDF System.Diagnostics.Process.Start(outputPath); // Create a renderer to convert HTML to PDF var renderer = new ChromePdfRenderer(); // Convert an HTML string to a PDF using var renderedPdf = renderer.RenderHtmlAsPdf("<h1>My First HTML to Pdf</h1>"); // Define the output path for the PDF var outputPath = "My_First_Html.pdf"; // Save the rendered PDF to the specified path renderedPdf.SaveAs(outputPath); // Automatically open the newly created PDF System.Diagnostics.Process.Start(outputPath); $vbLabelText $csharpLabel RenderHtmlAsPdf is a powerful tool that supports CSS, JavaScript, and images in total. It may be necessary to set the second argument of RenderHtmlAsPdf if these materials are stored on a hard disc. The following code will generate a PDF file: // Render HTML to PDF with a base path for local assets var renderPdf = renderer.RenderHtmlAsPdf("<img src='image_1.png'/>", @"C:\Newproject"); // Render HTML to PDF with a base path for local assets var renderPdf = renderer.RenderHtmlAsPdf("<img src='image_1.png'/>", @"C:\Newproject"); $vbLabelText $csharpLabel All CSS stylesheets, pictures, and JavaScript files referenced will be relative to the BaseUrlPath, allowing for a more organized and logical structure to be maintained. You can, of course, make use of pictures, stylesheets, and assets available on the internet, such as Web Fonts, Google Fonts, and even jQuery, if you choose. Create a PDF Document Using an Existing HTML URL Existing URLs can be rendered into PDFs with C# efficiently; this also enables teams to divide PDF design and back-end PDF rendering work across various sections, which is beneficial. The code below demonstrates how to render the endeavorcreative.com page from its URL: // Create a renderer for converting URLs to PDF var renderer = new ChromePdfRenderer(); // Convert the specified URL to a PDF using var renderedPdf = renderer.RenderUrlAsPdf("https://endeavorcreative.com/setting-up-wordpress-website-from-scratch/"); // Specify the output path for the PDF var outputPath = "Url_pdf.pdf"; // Save the PDF to the specified path renderedPdf.SaveAs(outputPath); // Open the newly created PDF System.Diagnostics.Process.Start(outputPath); // Create a renderer for converting URLs to PDF var renderer = new ChromePdfRenderer(); // Convert the specified URL to a PDF using var renderedPdf = renderer.RenderUrlAsPdf("https://endeavorcreative.com/setting-up-wordpress-website-from-scratch/"); // Specify the output path for the PDF var outputPath = "Url_pdf.pdf"; // Save the PDF to the specified path renderedPdf.SaveAs(outputPath); // Open the newly created PDF System.Diagnostics.Process.Start(outputPath); $vbLabelText $csharpLabel As a result, all the hyperlinks (HTML links) and even HTML forms are retained in the generated PDF. Create a PDF Document From an Existing HTML Document This section shows how to render any local HTML file. It will appear that the file has been opened using the file:/ protocol for all relative assets, such as CSS, pictures, and JavaScript, among others. // Create a renderer for existing HTML files var renderer = new ChromePdfRenderer(); // Render an HTML file to PDF using var renderedPdf = renderer.RenderHtmlFileAsPdf("Assets/test1.html"); // Specify the output path for the PDF var outputPath = "test1_pdf.pdf"; // Save the PDF to the specified path renderedPdf.SaveAs(outputPath); // Open the newly created PDF System.Diagnostics.Process.Start(outputPath); // Create a renderer for existing HTML files var renderer = new ChromePdfRenderer(); // Render an HTML file to PDF using var renderedPdf = renderer.RenderHtmlFileAsPdf("Assets/test1.html"); // Specify the output path for the PDF var outputPath = "test1_pdf.pdf"; // Save the PDF to the specified path renderedPdf.SaveAs(outputPath); // Open the newly created PDF System.Diagnostics.Process.Start(outputPath); $vbLabelText $csharpLabel The advantage of this strategy is that it allows developers to test HTML content in a browser while creating it. IronPDF's rendering engine is built on the Chrome web browser. Therefore, it is recommended to use XML to PDF Conversion as printing XML content to PDF can be done using XSLT templates. Converting ASP.NET Web Forms to a PDF File With a single line of code, you can convert ASP.NET online forms to PDF format instead of HTML. Place the line of code in the Page_Load method of the page's code-behind file to make it appear on the page. ASP.NET Web Forms Applications can either be created from scratch or opened from a previous version. Install the NuGet package if it is not already installed. The using keyword should be used to import the IronPdf namespace. Navigate to the code behind the page that you'd like to convert to PDF. For instance, the file Default.aspx.cs using ASP.NET. RenderThisPageAsPdf is a method on the AspxToPdf class. using IronPdf; using System; using System.Web.UI; namespace WebApplication7 { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { // Render the current page as a PDF in the browser AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.InBrowser); } } } using IronPdf; using System; using System.Web.UI; namespace WebApplication7 { public partial class _Default : Page { protected void Page_Load(object sender, EventArgs e) { // Render the current page as a PDF in the browser AspxToPdf.RenderThisPageAsPdf(AspxToPdf.FileBehavior.InBrowser); } } } $vbLabelText $csharpLabel This requires the IronPdf.Extensions.ASPX NuGet Package to be installed. It is not available in .NET Core because ASPX is superseded by the MVC model. Apply HTML Templating For Intranet and website developers, the ability to template or "batch produce" PDFs is a standard necessity. Rather than creating a template for a PDF document, the IronPDF Library offers a way to generate a template for HTML by leveraging existing, well-tested technology. A dynamically generated PDF file is created when the HTML template is supplemented with data from a query string or a database, as shown below. As an example, consider the C# String class and its properties. The Format method works well for basic "mail-merge" operations. // Basic HTML String Formatting string formattedString = String.Format("<h1>Hello {0}!</h1>", "World"); // Basic HTML String Formatting string formattedString = String.Format("<h1>Hello {0}!</h1>", "World"); $vbLabelText $csharpLabel Because HTML files can be pretty extensive, it is common to utilize arbitrary placeholders, such as [[NAME]], and then replace them with the actual data. The following example will generate three PDF documents, each of which will be customized for a different user. // Define an HTML template with a placeholder var htmlTemplate = "<p>[[NAME]]</p>"; // Sample data to replace placeholders var names = new[] { "John", "James", "Jenny" }; // Create a new PDF for each name foreach (var name in names) { // Replace placeholder with actual name var htmlInstance = htmlTemplate.Replace("[[NAME]]", name); // Create a renderer and render the HTML as PDF var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderHtmlAsPdf(htmlInstance); // Save the PDF with the name in the filename pdf.SaveAs($"{name}.pdf"); } // Define an HTML template with a placeholder var htmlTemplate = "<p>[[NAME]]</p>"; // Sample data to replace placeholders var names = new[] { "John", "James", "Jenny" }; // Create a new PDF for each name foreach (var name in names) { // Replace placeholder with actual name var htmlInstance = htmlTemplate.Replace("[[NAME]]", name); // Create a renderer and render the HTML as PDF var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderHtmlAsPdf(htmlInstance); // Save the PDF with the name in the filename pdf.SaveAs($"{name}.pdf"); } $vbLabelText $csharpLabel ASP.NET MVC Routing: Download the PDF Version of This Page With the ASP.NET MVC Framework, you may direct the user to a PDF file. When building a new ASP.NET MVC Application or adding an existing MVC Controller to an existing application, select this option. Start the Visual Studio new project wizard by selecting ASP.NET Web Application (.NET Framework) > MVC from the drop-down menu. Alternatively, you can open an existing MVC project. Replace the Index method in the HomeController file in the Controllers folder, or create a new controller in the Controllers folder. The following is an example of how the code should be written: using IronPdf; using System; using System.Web.Mvc; namespace WebApplication8.Controllers { public class HomeController : Controller { public ActionResult Index() { // Render a URL as PDF and return it in the response using var pdf = HtmlToPdf.StaticRenderUrlAsPdf(new Uri("https://en.wikipedia.org")); return File(pdf.BinaryData, "application/pdf", "Wiki.Pdf"); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } } using IronPdf; using System; using System.Web.Mvc; namespace WebApplication8.Controllers { public class HomeController : Controller { public ActionResult Index() { // Render a URL as PDF and return it in the response using var pdf = HtmlToPdf.StaticRenderUrlAsPdf(new Uri("https://en.wikipedia.org")); return File(pdf.BinaryData, "application/pdf", "Wiki.Pdf"); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } } $vbLabelText $csharpLabel Add a Cover Page to a PDF Document Add a Cover Page to a PDF document IronPDF simplifies the process of merging PDF documents. The most common application of this technique is to add a cover page or back page to an already-rendered PDF document that has been rendered. To accomplish this, prepare a cover page and then use the PdfDocument capabilities. To combine the two documents, use the Merge PDF Documents Method. // Create a renderer and render a PDF from a URL var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/"); // Merge the cover page with the rendered PDF using var merged = PdfDocument.Merge(new PdfDocument("CoverPage.pdf"), pdf); // Save the merged document merged.SaveAs("Combined.Pdf"); // Create a renderer and render a PDF from a URL var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/"); // Merge the cover page with the rendered PDF using var merged = PdfDocument.Merge(new PdfDocument("CoverPage.pdf"), pdf); // Save the merged document merged.SaveAs("Combined.Pdf"); $vbLabelText $csharpLabel Add a Watermark to Your Document Last but not least, adding a watermark to PDF documents can be accomplished using C# code; this can be used to add a disclaimer to each page of a document stating that it is "confidential" or "a sample." // Prepare a stamper with HTML content for the watermark HtmlStamper stamper = new HtmlStamper("<h2 style='color:red'>SAMPLE</h2>") { HorizontalOffset = new Length(-3, MeasurementUnit.Inch), VerticalAlignment = VerticalAlignment.Bottom }; // Create a renderer and render a PDF from a URL var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf"); // Apply the watermark to the PDF pdf.ApplyStamp(stamper); // Save the watermarked PDF pdf.SaveAs(@"C:\PathToWatermarked.pdf"); // Prepare a stamper with HTML content for the watermark HtmlStamper stamper = new HtmlStamper("<h2 style='color:red'>SAMPLE</h2>") { HorizontalOffset = new Length(-3, MeasurementUnit.Inch), VerticalAlignment = VerticalAlignment.Bottom }; // Create a renderer and render a PDF from a URL var renderer = new ChromePdfRenderer(); using var pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf"); // Apply the watermark to the PDF pdf.ApplyStamp(stamper); // Save the watermarked PDF pdf.SaveAs(@"C:\PathToWatermarked.pdf"); $vbLabelText $csharpLabel Your PDF File Can Be Protected Using a Password When you set the password property of a PDF document, it will be encrypted, and the user will be required to provide the correct password to read the document. This sample can be used in a .NET Core Console Application. using IronPdf; namespace ConsoleApp { class Program { static void Main(string[] args) { // Create a renderer and render a PDF from HTML var renderer = new ChromePdfRenderer(); using var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>"); // Set password to protect the PDF pdfDocument.Password = "strong!@#pass&^%word"; // Save the secured PDF pdfDocument.SaveAs("secured.pdf"); } } } using IronPdf; namespace ConsoleApp { class Program { static void Main(string[] args) { // Create a renderer and render a PDF from HTML var renderer = new ChromePdfRenderer(); using var pdfDocument = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>"); // Set password to protect the PDF pdfDocument.Password = "strong!@#pass&^%word"; // Save the secured PDF pdfDocument.SaveAs("secured.pdf"); } } } $vbLabelText $csharpLabel Without the advantages mentioned above, with IronPDF, you can also: Extract images and text from PDFs Edit the HTML content of PDFs Enhance foreground and background images Add digital signature to PDFs Auto-fill your PDF forms quickly and effortlessly Creating PDFs is such a challenging undertaking; some people may have never come across the fundamental notions they should employ to produce the most outstanding documents. As a result, IronPDF is extremely helpful, as it simplifies creating PDFs and, as a result, improves the original presentation of documents created from PDFs and HTML. Based on the information provided in the documentation and competitor analysis: IronPDF is the most effective tool to use when creating PDFs, making it simple for anybody, including those who work in offices or schools, to complete their tasks efficiently. How to view PDF files in ASP.NET using C# and IronPDF IronPDF is a must-have .NET library. Get yours now and try it with IronPDF NuGet Package. 자주 묻는 질문 C#을 사용하는 ASP.NET 애플리케이션에서 PDF 파일을 보려면 어떻게 해야 하나요? IronPDF를 사용하면 PDF를 이미지 또는 웹 페이지에 삽입할 수 있는 HTML 요소로 렌더링하여 ASP.NET 애플리케이션에서 PDF 파일을 볼 수 있습니다. ASP.NET에서 HTML 페이지를 PDF로 변환하는 단계는 무엇인가요? ASP.NET에서 HTML 페이지를 PDF로 변환하려면 정확한 렌더링을 위해 CSS와 JavaScript를 지원하는 IronPDF의 RenderHtmlAsPdf 메서드를 사용할 수 있습니다. C#에서 여러 PDF 문서를 병합하려면 어떻게 해야 하나요? IronPDF를 사용하면 서로 다른 PDF 파일을 하나의 문서로 결합하는 PdfDocument.Merge 메서드를 사용하여 여러 PDF 문서를 병합할 수 있습니다. ASP.NET에서 PDF 문서에 워터마크를 추가할 수 있나요? 예, 사용자 정의 HTML 콘텐츠를 오버레이하는 HtmlStamper 클래스를 사용하여 IronPDF를 사용하여 ASP.NET의 PDF 문서에 워터마크를 추가할 수 있습니다. C#을 사용하여 PDF 파일에 비밀번호 보호를 구현하려면 어떻게 해야 하나요? IronPDF를 사용하여 PDF 파일에 비밀번호 보호를 구현하려면 PdfDocument에 Password 속성을 설정하여 파일을 암호화할 수 있습니다. IronPDF를 사용하여 ASP.NET 웹 양식을 PDF로 변환할 수 있나요? 예, IronPDF는 전체 웹 양식을 PDF 문서로 캡처하여 RenderThisPageAsPdf와 같은 메서드를 사용하여 ASP.NET 웹 양식을 PDF로 변환할 수 있습니다. ASP.NET에서 PDF를 생성할 때 IronPDF는 어떤 이점을 제공하나요? IronPDF는 내장된 Google Chromium 엔진을 사용하여 HTML, CSS 및 JavaScript를 정확하게 렌더링하는 등의 이점을 제공하여 ASP.NET에서 PDF 생성을 위한 유연한 도구입니다. ASP.NET 프로젝트에 IronPDF를 설치하려면 어떻게 해야 하나요? NuGet 패키지 관리자를 통해 또는 IronPDF 웹사이트에서 직접 DLL 파일을 다운로드하여 ASP.NET 프로젝트에 IronPDF를 설치할 수 있습니다. IronPDF가 소프트웨어 개발자에게 귀중한 자산이 되는 이유는 무엇인가요? IronPDF는 복잡한 PDF 생성 작업을 간소화하고 ASP.NET 애플리케이션에 원활하게 통합되어 효율적인 PDF 조작이 가능하므로 소프트웨어 개발자에게 귀중한 자산입니다. IronPDF를 사용하여 C#의 URL에서 PDF를 만들려면 어떻게 해야 하나요? URL에서 콘텐츠를 가져와 PDF 문서로 변환하는 IronPDF의 RenderUrlAsPdf 메서드를 사용하여 C#의 URL에서 PDF를 만들 수 있습니다. .NET 10 지원: IronPDF는 ASP.NET에서 PDF 파일을 보기 위해 .NET 10과 호환되나요? 예 - IronPDF는 ASP.NET 또는 ASP.NET Core를 사용하는 웹 애플리케이션을 포함하여 .NET 10을 완벽하게 지원합니다. 특별한 구성 없이도 .NET 10 프로젝트 전반에서 원활하게 작동합니다. 이전 .NET 버전에서와 마찬가지로 RenderUrlAsPdf와 같은 익숙한 방법을 사용하거나 MIME 유형 application/pdf가 포함된 FileStreamResult를 반환할 수 있습니다. IronPDF는 크로스 플랫폼 지원을 위해 설계되었으며 .NET 10은 지원되는 프레임워크에 명시적으로 나열되어 있습니다([ironpdf.com](https://ironpdf.com/?utm_source=openai)) 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, 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! 더 읽어보기 Generating PDF Files in C# (2026 Guide)Generating PDFs in C# using IronPDF
업데이트됨 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! 더 읽어보기