IRONPDF 사용 How to Use ChatGPT with IronPDF For C# Developer 커티스 차우 업데이트됨:6월 22, 2025 다운로드 IronPDF NuGet 다운로드 DLL 다운로드 윈도우 설치 프로그램 무료 체험 시작하기 LLM용 사본 LLM용 사본 LLM용 마크다운 형식으로 페이지를 복사하세요 ChatGPT에서 열기 ChatGPT에 이 페이지에 대해 문의하세요 제미니에서 열기 제미니에게 이 페이지에 대해 문의하세요 Grok에서 열기 Grok에게 이 페이지에 대해 문의하세요 혼란 속에서 열기 Perplexity에게 이 페이지에 대해 문의하세요 공유하다 페이스북에 공유하기 트위터에 공유하기 LinkedIn에 공유하기 URL 복사 이메일로 기사 보내기 1.0 What is ChatGPT? ChatGPT is an artificial intelligence (AI) chatbot created by OpenAI. The term "ChatGPT" combines the words "Chat," which alludes to the chatbot feature of the system, and "GPT," which stands for Generative Pre-trained Transformer and is a kind of large language model (LLM). The fundamental GPT models from OpenAI, namely GPT-3.5 and GPT-4, serve as the basis for ChatGPT, which has been refined (a method of transfer learning) for conversational applications utilizing a combination of supervised and reinforcement learning techniques, which includes machine learning, natural language processing, and artificial intelligence. ChatGPT can understand and generate human-like text. This article will demonstrate how to develop a MAUI application that makes use of the OpenAI ChatGPT API to take messages, offer results based on user queries, and then export those results as a PDF file for later usage using IronPDF. 1.1 Setup OpenAI account To register for an OpenAI account, do the following: Visit the official OpenAI website. On the website's home page, locate and click the Sign-Up button. This will take you to the account creation form. Complete the sign-up form's essential fields. Click on the verification link issued to your registered email account to confirm your email address. If your registration is successful, you should be able to access your OpenAI account by entering the login information you gave when registering. 1.2 Getting an OpenAI API key To access OpenAI, go to the website and log in with your account information. Access OpenAI website Navigate to the OpenAI platform's API area. Then Account Settings > View API key where you may find this. Now you can create a New secret API key. Create API keys 2.0 Getting Started with .NET MAUI Application You need Visual Studio 2022 and .NET 7 Framework installed for creating the .NET MAUI application written in C#. Then, follow the next steps to create and write a .NET MAUI app. 2.1 Open Visual Studio Open Visual Studio, then select "Create a New Project" from the menu and enter ".NET MAUI" into the search field. 2.2 Choose the .NET MAUI App In Visual Studio, choose the .NET MAUI app template from the list of search results. After choosing it, give it a decent name and choose the project's location. Click "Next" after the configuration is complete. Create a new .NET MAUI App in Visual Studio 2.3 Select Framework Choose the necessary framework; nevertheless, for example, it is advised to choose the most recent .NET Framework. Press the Create button in Visual Studio after choosing the framework version. Configure the new project In Visual Studio 2022, a new .NET MAUI Project will be created. .NET MAUI, by default, develops a straightforward counter application. .NET Framework selection By modifying the .NET MAUI application, the ChatGPT OpenAI can be integrated and export the result into PDF files using the IronPDF C# PDF library on this variant of platforms. 2.4 Install the OpenAI Package Enter the next command into the NuGet Package Manager Console. Install-Package OpenAI This command will install the OpenAI package, which provides access to the API needed for interacting with ChatGPT using C#. 2.5 Install IronPDF Enter the following command to install the IronPDF package: Install-Package IronPdf The command above installs IronPDF into the MAUI project. IronPDF is used for rendering HTML content into PDF files and is a key part of exporting data from the app to a PDF document. 3.0 What is IronPDF? Developers can swiftly create, read, and edit PDF documents thanks to IronPDF, a robust PDF SDK foundation for PDF processing. The Chrome engine is used by the IronPDF library to convert HTML to PDF. Among the several web components that the library supports are MAUI, Xamarin, Blazor, Unity, HoloLens apps, Windows Forms, HTML, ASPX, Razor HTML, .NET Core, ASP.NET, and WPF. Microsoft.NET and .NET Core programming can be used in both traditional Windows Applications and ASP.NET web apps. Using HTML5, JavaScript, CSS, and images, IronPDF enables you to create attractive PDFs that have a title and footer. The API library includes a robust HTML-to-PDF converter that can deal with PDFs as well as a stand-alone PDF conversion tool and engine that is independent of any outside sources. Users can generate PDFs with IronPDF from a variety of sources, including image files, HTML, HTML5, ASPX, and Razor/MVC View. The library offers programs for text searching, extracting text and images from PDF pages, and converting PDF pages to images. It also offers a program for interactive form completion and submission. The library also provides links as the basis for PDF publications, along with the use of user agents, proxies, cookies, HTTP headers, and form variables for authentication behind HTML login forms. IronPDF accepts usernames and passwords in exchange for access to password-protected PDF files. To know more about the IronPDF, refer to the HTML-to-PDF conversion tutorial pages. 4.0 Export ChatGPT API Result using IronPDF Add the below code in the "MauiProgram.cs" file: builder.Services.AddChatGpt(options => { options.UseOpenAI("API key here"); // Replace with your actual OpenAI API key options.DefaultModel = OpenAIChatGptModels.Gpt35Turbo; // Set the default model options.MessageLimit = 10; // Limit number of messages per session options.MessageExpiration = TimeSpan.FromMinutes(5); // Set message expiration time }); builder.Services.AddChatGpt(options => { options.UseOpenAI("API key here"); // Replace with your actual OpenAI API key options.DefaultModel = OpenAIChatGptModels.Gpt35Turbo; // Set the default model options.MessageLimit = 10; // Limit number of messages per session options.MessageExpiration = TimeSpan.FromMinutes(5); // Set message expiration time }); $vbLabelText $csharpLabel This code snippet registers a service for the ChatGPT API, which can then be used by other classes or pages in your application. Add the following code on the main page of the application in the page load method. This helps to get the ChatGPT service instance and store it into a local object. _chatGptClient = Handler.MauiContext.Services.GetService<IChatGptClient>(); _chatGptClient = Handler.MauiContext.Services.GetService<IChatGptClient>(); $vbLabelText $csharpLabel This code retrieves the ChatGPT client instance from the service provider, allowing the main page to interact with the ChatGPT API. Next, create a user interface like the one depicted in the following XAML code: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ChatGPT_MauiApp.MainPage" BackgroundColor="black"> <StackLayout> <StackLayout Orientation="Horizontal" Spacing="25" Padding="30,0"> <ScrollView WidthRequest="700" HeightRequest="200" x:Name="scrollView"> <TableView Intent="Data" WidthRequest="700" x:Name="Table_View" BackgroundColor="DarkSlateGrey"> <TableRoot> </TableRoot> </TableView> </ScrollView> </StackLayout> <StackLayout Padding="30,0"> <Editor x:Name="Userquest" Text="" HorizontalOptions="Start" FontSize="12" Placeholder=" Enter your Queries" HeightRequest="25" WidthRequest="700" /> </StackLayout> <StackLayout Padding="30,10,10,0"> <FlexLayout> <Button x:Name="Sendquery" Text="Send Query" SemanticProperties.Hint="Click to send query to BOT" Clicked="SendqueryClicked" HorizontalOptions="Center" BackgroundColor="Green" TextColor="WhiteSmoke" /> <Button x:Name="Export" Text="Export" SemanticProperties.Hint="Click to export data" Clicked="OnExportClicked" HorizontalOptions="Center" BackgroundColor="DodgerBlue" TextColor="WhiteSmoke" /> </FlexLayout> </StackLayout> </StackLayout> </ContentPage> <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ChatGPT_MauiApp.MainPage" BackgroundColor="black"> <StackLayout> <StackLayout Orientation="Horizontal" Spacing="25" Padding="30,0"> <ScrollView WidthRequest="700" HeightRequest="200" x:Name="scrollView"> <TableView Intent="Data" WidthRequest="700" x:Name="Table_View" BackgroundColor="DarkSlateGrey"> <TableRoot> </TableRoot> </TableView> </ScrollView> </StackLayout> <StackLayout Padding="30,0"> <Editor x:Name="Userquest" Text="" HorizontalOptions="Start" FontSize="12" Placeholder=" Enter your Queries" HeightRequest="25" WidthRequest="700" /> </StackLayout> <StackLayout Padding="30,10,10,0"> <FlexLayout> <Button x:Name="Sendquery" Text="Send Query" SemanticProperties.Hint="Click to send query to BOT" Clicked="SendqueryClicked" HorizontalOptions="Center" BackgroundColor="Green" TextColor="WhiteSmoke" /> <Button x:Name="Export" Text="Export" SemanticProperties.Hint="Click to export data" Clicked="OnExportClicked" HorizontalOptions="Center" BackgroundColor="DodgerBlue" TextColor="WhiteSmoke" /> </FlexLayout> </StackLayout> </StackLayout> </ContentPage> XML The ContentPage above defines the UI layout of the application. Users can enter queries, interact with the ChatGPT API via the "Send Query" button, and export the results as a PDF using the "Export" button. Results are displayed in TableView. Next is the code-behind logic for handling button clicks and exporting data: private void OnExportClicked(object sender, EventArgs e) { StringBuilder db = new(); foreach (var tableSection in Table_View.Root.ToList()) { foreach (var cell in tableSection) { if (cell is TextCell textCell) { db.Append("<p style='color:red;text-align:left;'>" + textCell.Text + "</p>"); db.Append("<p style='color:black;text-align:justify;'>" + textCell.Detail + "</p>"); } } } // Create and save the PDF var renderer = new IronPdf.ChromePdfRenderer(); var pdf = renderer.RenderHtmlAsPdf(db.ToString()); pdf.SaveAs("F:\\Download\\Demo.pdf"); } private async void SendqueryClicked(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Userquest.Text)) { var query = Userquest.Text; Userquest.Text = ""; var tableSection = AddQueryToTable(query); ChatGptResponse response = await _chatGptClient.AskAsync(_sessionGuid, query); var resp = response.GetMessage(); AddResponseToTable(tableSection, resp); } } private TableSection AddQueryToTable(string query) { var textCell = new TextCell { Text = query, TextColor = Colors.Red, DetailColor = Colors.WhiteSmoke, Detail = "" }; var tableSection = new TableSection { textCell }; Table_View.Root.Add(tableSection); return tableSection; } private void AddResponseToTable(TableSection section, string response) { if (section.FirstOrDefault() is TextCell textCell) { textCell.Detail = response; } } private void OnExportClicked(object sender, EventArgs e) { StringBuilder db = new(); foreach (var tableSection in Table_View.Root.ToList()) { foreach (var cell in tableSection) { if (cell is TextCell textCell) { db.Append("<p style='color:red;text-align:left;'>" + textCell.Text + "</p>"); db.Append("<p style='color:black;text-align:justify;'>" + textCell.Detail + "</p>"); } } } // Create and save the PDF var renderer = new IronPdf.ChromePdfRenderer(); var pdf = renderer.RenderHtmlAsPdf(db.ToString()); pdf.SaveAs("F:\\Download\\Demo.pdf"); } private async void SendqueryClicked(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Userquest.Text)) { var query = Userquest.Text; Userquest.Text = ""; var tableSection = AddQueryToTable(query); ChatGptResponse response = await _chatGptClient.AskAsync(_sessionGuid, query); var resp = response.GetMessage(); AddResponseToTable(tableSection, resp); } } private TableSection AddQueryToTable(string query) { var textCell = new TextCell { Text = query, TextColor = Colors.Red, DetailColor = Colors.WhiteSmoke, Detail = "" }; var tableSection = new TableSection { textCell }; Table_View.Root.Add(tableSection); return tableSection; } private void AddResponseToTable(TableSection section, string response) { if (section.FirstOrDefault() is TextCell textCell) { textCell.Detail = response; } } $vbLabelText $csharpLabel Explanation: The OnExportClicked method creates a PDF from HTML content gathered from the UI using IronPDF. The generated PDF is saved to a specified location. The SendqueryClicked method takes the user's query, sends it to the OpenAI API using the _chatGptClient, and displays the response. It also adds the query and response to TableView. Helper methods AddQueryToTable and AddResponseToTable assist in updating the UI components with user queries and chatbot responses. After adding the above code, try to run your solution. Enter a query and retrieve the result by clicking the "Send Query" button. It will send the user's query to the ChatGPT API, retrieve the result, and display the message on the screen. Add text query into the application Click on the "Export" button to export results into a PDF. The exported PDF file Now, we were able to create a chatbot using ChatGPT and export that chat using IronPDF on a MAUI App. Using the above concept, it is possible to include images, audio, and video from the ChatGPT API for more accurate results. 5.0 Conclusion The goal of this article is to develop a MAUI application that makes use of the OpenAI ChatGPT API to take messages, offer results based on user queries, and export those results as a PDF file. To improve the caliber of the suggestions, feel free to explore by altering the questions. To see if various models produce better results, you can also experiment with modifying the ChatGptModels enum value within the AddChatGpt method in "MauiProgram.cs". The ChatGPT API is a powerful AI program that allows us to provide results based on the user query. The cost for ChatGPT API is calculated based on the number of requests sent. IronPDF is used to make API requests and export the result into PDF for future uses, avoiding repeatedly querying the same API request. We can create PDFs using only a few lines of code with IronPDF. This application is suitable for beginners and only requires fundamental knowledge to use. No other package is dependent on IronPDF in any way. For instance, it is a library that comes in a single package. IronPDF developers can choose from a variety of licenses to suit their requirements. There is also a free trial available. For complete pricing and licensing information about IronPDF, kindly refer to the IronPDF licensing page. 자주 묻는 질문 ChatGPT를 .NET MAUI 애플리케이션과 통합하려면 어떻게 해야 하나요? ChatGPT를 .NET MAUI 애플리케이션과 통합하려면 먼저 OpenAI 계정을 설정하고 API 키를 받습니다. 그런 다음 NuGet을 통해 프로젝트에 OpenAI 패키지를 설치하고 사용자 쿼리를 처리하도록 애플리케이션에서 API를 구성합니다. MAUI 앱에서 API 결과를 PDF로 변환하려면 어떻게 해야 하나요? IronPDF를 사용하여 MAUI 앱에서 API 결과를 PDF로 변환할 수 있습니다. ChatGPT API에서 응답을 검색한 후 IronPDF의 메서드를 사용하여 HTML 콘텐츠를 PDF로 렌더링합니다. ChatGPT 기반 MAUI 앱 설정에는 어떤 단계가 포함되나요? ChatGPT 기반 MAUI 앱을 설정하려면 Visual Studio에서 새 .NET MAUI 프로젝트를 만들고, OpenAI 및 IronPDF 패키지를 설치하고, 코드에서 API 설정을 구성하고, 쿼리를 처리하고 PDF로 출력하는 로직을 작성하세요. IronPDF는 PDF를 만들 때 HTML, JavaScript 및 CSS 콘텐츠를 처리할 수 있나요? 예, IronPDF는 PDF를 만들 때 HTML, JavaScript 및 CSS 콘텐츠를 처리할 수 있습니다. Chrome 렌더링 엔진을 사용하여 HTML 콘텐츠를 PDF 문서로 변환합니다. 내 애플리케이션에서 ChatGPT API 설정을 사용자 지정할 수 있나요? 예, 모델 유형, 메시지 제한, 만료 시간 등의 매개변수를 MauiProgram.cs 파일에서 조정하여 애플리케이션에서 ChatGPT API 설정을 사용자 지정할 수 있습니다. MAUI 애플리케이션에서 IronPDF를 사용하면 어떤 이점이 있나요? IronPDF는 PDF 생성, 읽기 및 편집을 위한 강력한 SDK를 제공합니다. HTML 콘텐츠를 PDF로 변환하고, 텍스트 추출을 지원하며, MAUI 애플리케이션에서 PDF 처리를 향상시키는 다양한 기능을 제공합니다. IronPDF에 무료 평가판이 있나요? 예, IronPDF는 무료 평가판을 제공하여 개발자가 라이선스 플랜에 가입하기 전에 기능을 살펴볼 수 있도록 합니다. MAUI에서 ChatGPT PDF 프로젝트에 필요한 패키지를 설치하려면 어떻게 해야 하나요? Visual Studio의 NuGet 패키지 관리자 콘솔을 사용하여 OpenAI 및 IronPDF 패키지를 설치합니다. Install-Package OpenAI 및 Install-Package IronPDF를 실행하여 프로젝트에 추가합니다. PDF 문서를 처리할 때 IronPDF의 역할은 무엇인가요? IronPDF는 PDF 문서를 생성, 편집 및 변환하는 데 사용됩니다. 개발자가 웹 콘텐츠를 PDF로 변환하고, 텍스트 검색을 수행하고, 이미지를 추출할 수 있어 PDF 기능이 필요한 애플리케이션에 이상적입니다. IronPDF는 .NET 10과 완벽하게 호환되나요? 예, IronPDF는 .NET 10과 완벽하게 호환됩니다. .NET 10, 9, 8, 7, 6, Core 및 .NET Framework를 포함한 모든 주요 .NET 버전을 지원하며, 특별한 구성 없이 .NET 10 프로젝트에서 바로 작동하도록 설계되었습니다. 커티스 차우 지금 바로 엔지니어링 팀과 채팅하세요 기술 문서 작성자 커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, 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 Use Fluent Validation With IronPDF in C#How to Create PDF Signatures in .NET
업데이트됨 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! 더 읽어보기