Jak przekonwertować obraz na PDF w C# [Samouczek z przykładem kodu]
IronPDF provides a simple, free solution for converting images to PDF in C# through its ImageToPdf method, allowing developers to convert single or multiple images with just a few lines of code and customizable page settings.
Numerous libraries allow C# developers to convert images to PDFs. Finding a free, user-friendly library with good performance can be challenging, as some are paid, complex, or limited in functionality. Among these libraries, IronPDF stands out as a free, efficient, and easy-to-implement C# library. It comes with comprehensive documentation and dedicated support.
IronPDF for .NET to biblioteka .NET służąca do generowania, odczytu, edycji i zapisywania plików PDF w projektach .NET. IronPDF features HTML-to-PDF for .NET 5, Core, Standard & Framework with full HTML-to-PDF support, including CSS3 and JS. The library leverages a Chrome rendering engine to ensure pixel-perfect PDF generation from various sources.
Let's look at how to create a sample project to learn about converting images to PDF. This tutorial will guide you through the installation process, basic image conversion, and advanced features for handling multiple images and different formats.
Jak przekonwertować obraz na PDF w języku C#
- Install image to PDF C# library
- Utilize
`ImageToPdf`method to convert image to PDF - Specify optional image's behavior on page
- Input optional PDF page's settings
- Save the PDF to desired location
How Do I Create a Visual Studio Project?
To create a new project, open Microsoft Visual Studio. It's recommended to use the latest version of Visual Studio. The steps for creating a new project may differ between versions, but the remainder should be the same for every version.
- Click on Create New Project.
- Select Project Template, then select the Console Application template for this demonstration. You can use any template as per your requirement, including ASP.NET Core or Blazor applications.
- Click on Next. Name the Project (for example, "
ImageToPDFConverter"). - Click Next and select the .NET Framework version.
- Kliknij przycisk Utwórz.
The new project will be created as shown below. The project structure will include a Program.cs file where we'll write our image conversion code.
Utwórz nową aplikację konsolową w Visual Studio
Którą wersję .NET Framework powinienem wybrać?
IronPDF supports a wide range of .NET versions, including .NET Framework 4.6.2+, .NET Core 3.1+, and .NET 5/6/7/8+. For new projects, it's recommended to use the latest LTS (Long Term Support) version of .NET for optimal performance and security updates. The library also works seamlessly on Windows, Linux, and macOS platforms.
Next, install the IronPDF NuGet Package in this project to use its features. The great thing about IronPDF is that it takes the frustration out of generating PDF documents by not relying on proprietary APIs. HTML to PDF rendering renders pixel-perfect PDFs from open standard document types: HTML, JS, CSS, JPG, PNG, GIF, and SVG. In short, it uses the skills that developers already possess.
How Do I Install the IronPDF NuGet Package?
To install the NuGet Package, go to Tools > NuGet Package Manager > Package Manager Console. Pojawi się następujące okno:
Interfejs użytkownika konsoli menedżera pakietów
Next, write the following command in the Package Manager Console:
Install-Package IronPdf
Naciśnij Enter. The installation process will download IronPDF and its dependencies, including the necessary Chrome rendering engine components.
Zainstaluj pakiet IronPdf w konsoli menedżera pakietów
Jakie są alternatywne metody instalacji?
You can also install IronPDF through:
- NuGet Package Manager UI: Right-click on your project, select "Manage NuGet Packages," search for "IronPdf," and click Install
- Package Reference: Add
<PackageReference Include="IronPdf" Version="*" />to your .csproj file - Direct Download: Download the DLL from the IronPDF website and reference it manually
- Command Line: Use
dotnet add package IronPdfin the terminal
For Azure deployments, you might need additional configuration. Similarly, Docker environments require specific setup steps.
How Do I Convert an Image File to PDF Document?
The next step will show how to convert the following image to PDF. IronPDF makes this process straightforward with its ImageToPdf converter functionality.
Jakie formaty obrazów są obsługiwane?
IronPDF supports a wide variety of image formats for PDF conversion:
- JPEG/JPG: The most common format for photographs
- PNG: Ideal for images with transparency
- GIF: Including animated GIFs (first frame used)
- BMP: Windows bitmap format
- TIFF: Including multi-page TIFF files
- SVG: Scalable vector graphics
- WebP: Modern web image format
The sample image
To use the library, reference the IronPDF library in the program.cs file. Write the following code snippet at the top of the file:
using IronPdf;
using IronPdf.Imaging;
using System.Linq;
using IronPdf;
using IronPdf.Imaging;
using System.Linq;
Imports IronPdf
Imports IronPdf.Imaging
Imports System.Linq
Następnie napisz poniższy kod wewnątrz funkcji main. This will convert a JPG file to a PDF file:
public static void Main(string[] args)
{
// Convert a single image to the PDF document
PdfDocument doc = ImageToPdfConverter.ImageToPdf(@"D:\Iron Software\ImageToPDF\bird.jpg", IronPdf.Imaging.ImageBehavior.CropPage);
// Optional: Set document properties
doc.MetaData.Author = "IronPDF Tutorial";
doc.MetaData.Title = "Image to PDF Conversion";
doc.MetaData.Subject = "Converting JPG to PDF";
// Save the resulting PDF to the specified path
doc.SaveAs(@"D:\Iron Software\ImageToPDF\bird.pdf");
Console.WriteLine("PDF created successfully!");
}
public static void Main(string[] args)
{
// Convert a single image to the PDF document
PdfDocument doc = ImageToPdfConverter.ImageToPdf(@"D:\Iron Software\ImageToPDF\bird.jpg", IronPdf.Imaging.ImageBehavior.CropPage);
// Optional: Set document properties
doc.MetaData.Author = "IronPDF Tutorial";
doc.MetaData.Title = "Image to PDF Conversion";
doc.MetaData.Subject = "Converting JPG to PDF";
// Save the resulting PDF to the specified path
doc.SaveAs(@"D:\Iron Software\ImageToPDF\bird.pdf");
Console.WriteLine("PDF created successfully!");
}
Public Shared Sub Main(args As String())
' Convert a single image to the PDF document
Dim doc As PdfDocument = ImageToPdfConverter.ImageToPdf("D:\Iron Software\ImageToPDF\bird.jpg", IronPdf.Imaging.ImageBehavior.CropPage)
' Optional: Set document properties
doc.MetaData.Author = "IronPDF Tutorial"
doc.MetaData.Title = "Image to PDF Conversion"
doc.MetaData.Subject = "Converting JPG to PDF"
' Save the resulting PDF to the specified path
doc.SaveAs("D:\Iron Software\ImageToPDF\bird.pdf")
Console.WriteLine("PDF created successfully!")
End Sub
How Does ImageBehavior Affect the Output?
In the above code example, the ImageToPdfConverter class provided by IronPDF is used for image conversion. The ImageToPdf method can be used to create PDF documents from images. It accepts both image files and a System.Drawing object as input.
The static method ImageToPdf converts a single image file to an identical PDF document of matching dimensions. Przyjmuje dwa argumenty: ścieżkę do obrazu oraz zachowanie obrazu (sposób wyświetlania obrazu na papierze). The ImageBehavior enum provides several options:
CropPage: Sets PDF page size to match image dimensionsCenteredOnPage: Centers image on page without resizingFitToPage: Scales image to fit within page marginsFitToPageAndMaintainAspectRatio: Scales while preserving aspect ratio
Imaging.ImageBehavior.CropPage will set the paper size equal to the image size. The default page size is A4. You can set it via the following line of code:
ImageToPdfConverter.PaperSize = IronPdf.Rendering.PdfPaperSize.Letter;
ImageToPdfConverter.PaperSize = IronPdf.Rendering.PdfPaperSize.Letter;
ImageToPdfConverter.PaperSize = IronPdf.Rendering.PdfPaperSize.Letter
Można również ustawić niestandardowe rozmiary stron dla konkretnych wymagań:
// Set custom page size in millimeters
ImageToPdfConverter.PaperSize = new IronPdf.Rendering.PdfPaperSize(210, 297);
// Set custom page size in millimeters
ImageToPdfConverter.PaperSize = new IronPdf.Rendering.PdfPaperSize(210, 297);
' Set custom page size in millimeters
ImageToPdfConverter.PaperSize = New IronPdf.Rendering.PdfPaperSize(210, 297)
Jakie opcje rozmiarów papieru są dostępne?
Dostępnych jest wiele opcji rozmiaru strony, które można ustawić zgodnie z własnymi wymaganiami. IronPDF obsługuje wszystkie standardowe formaty papieru:
- Seria A: A0, A1, A2, A3, A4 (domyślnie), A5, A6, A7, A8, A9, A10
- Seria B: od B0 do B10
- Rozmiary amerykańskie: Letter, Legal, Ledger, Tabloid, Executive
- Inne: Foolscap, Crown, Demy, Royal i inne
Można również skonfigurować orientację strony (pionową lub poziomą) oraz niestandardowe marginesy dla plików PDF.
Jak przekonwertować wiele obrazów do pliku PDF?
Poniższy przykład konwertuje obrazy JPG do nowego dokumentu. Jest to szczególnie przydatne do tworzenia albumów fotograficznych, katalogów lub łączenia zeskanowanych dokumentów:
public static void Main(string[] args)
{
// Enumerate and filter JPG files from the specified directory
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));
// Sort files alphabetically (optional)
var sortedImageFiles = imageFiles.OrderBy(f => f);
// Convert the images to a PDF document
PdfDocument doc = ImageToPdfConverter.ImageToPdf(sortedImageFiles);
// Add page numbers to each page
for (int i = 0; i < doc.PageCount; i++)
{
doc.AddTextFooter($"Page {i + 1} of {doc.PageCount}",
FontFamily.Arial,
fontSize: 10,
y: 25);
}
// Save the combined PDF
doc.SaveAs(@"D:\Iron Software\ImageToPDF\JpgToPDF.pdf");
Console.WriteLine($"Combined {doc.PageCount} images into a single PDF!");
}
public static void Main(string[] args)
{
// Enumerate and filter JPG files from the specified directory
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => f.EndsWith(".jpg") || f.EndsWith(".jpeg"));
// Sort files alphabetically (optional)
var sortedImageFiles = imageFiles.OrderBy(f => f);
// Convert the images to a PDF document
PdfDocument doc = ImageToPdfConverter.ImageToPdf(sortedImageFiles);
// Add page numbers to each page
for (int i = 0; i < doc.PageCount; i++)
{
doc.AddTextFooter($"Page {i + 1} of {doc.PageCount}",
FontFamily.Arial,
fontSize: 10,
y: 25);
}
// Save the combined PDF
doc.SaveAs(@"D:\Iron Software\ImageToPDF\JpgToPDF.pdf");
Console.WriteLine($"Combined {doc.PageCount} images into a single PDF!");
}
Imports System
Imports System.IO
Imports System.Linq
Public Module Program
Public Sub Main(args As String())
' Enumerate and filter JPG files from the specified directory
Dim imageFiles = Directory.EnumerateFiles("D:\Iron Software\ImageToPDF\") _
.Where(Function(f) f.EndsWith(".jpg") OrElse f.EndsWith(".jpeg"))
' Sort files alphabetically (optional)
Dim sortedImageFiles = imageFiles.OrderBy(Function(f) f)
' Convert the images to a PDF document
Dim doc As PdfDocument = ImageToPdfConverter.ImageToPdf(sortedImageFiles)
' Add page numbers to each page
For i As Integer = 0 To doc.PageCount - 1
doc.AddTextFooter($"Page {i + 1} of {doc.PageCount}",
FontFamily.Arial,
fontSize:=10,
y:=25)
Next
' Save the combined PDF
doc.SaveAs("D:\Iron Software\ImageToPDF\JpgToPDF.pdf")
Console.WriteLine($"Combined {doc.PageCount} images into a single PDF!")
End Sub
End Module
Jak mogę filtrować różne formaty obrazów?
In the above code, System.IO.Directory.EnumerateFiles retrieves all files available in the specified folder. The Where clause filters all the JPG images from that folder and stores them in the imageFiles collection. If you have PNG or any other image format, you can just add that to the Where query:
// Filter multiple image formats
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => f.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase));
// Filter multiple image formats
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => f.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".png", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) ||
f.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase));
' Filter multiple image formats
Dim imageFiles = System.IO.Directory.EnumerateFiles("D:\Iron Software\ImageToPDF\") _
.Where(Function(f) f.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase) OrElse _
f.EndsWith(".jpeg", StringComparison.OrdinalIgnoreCase) OrElse _
f.EndsWith(".png", StringComparison.OrdinalIgnoreCase) OrElse _
f.EndsWith(".bmp", StringComparison.OrdinalIgnoreCase) OrElse _
f.EndsWith(".gif", StringComparison.OrdinalIgnoreCase) OrElse _
f.EndsWith(".tiff", StringComparison.OrdinalIgnoreCase))
Można również zastosować bardziej zwięzłe podejście, wykorzystując szereg rozszerzeń:
string[] imageExtensions = { ".jpg", ".jpeg", ".png", ".bmp", ".gif", ".tiff" };
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => imageExtensions.Any(ext => f.EndsWith(ext, StringComparison.OrdinalIgnoreCase)));
string[] imageExtensions = { ".jpg", ".jpeg", ".png", ".bmp", ".gif", ".tiff" };
var imageFiles = System.IO.Directory.EnumerateFiles(@"D:\Iron Software\ImageToPDF\")
.Where(f => imageExtensions.Any(ext => f.EndsWith(ext, StringComparison.OrdinalIgnoreCase)));
Dim imageExtensions As String() = {".jpg", ".jpeg", ".png", ".bmp", ".gif", ".tiff"}
Dim imageFiles = System.IO.Directory.EnumerateFiles("D:\Iron Software\ImageToPDF\") _
.Where(Function(f) imageExtensions.Any(Function(ext) f.EndsWith(ext, StringComparison.OrdinalIgnoreCase)))
W jakiej kolejności obrazy pojawią się w pliku PDF?
Domyślnie obrazy wyświetlane są w kolejności zwracanej przez system plików, która może nie być alfabetyczna. Aby kontrolować kolejność, można posortować pliki:
- Alphabetical:
imageFiles.OrderBy(f => f) - By Creation Date:
imageFiles.OrderBy(f => new FileInfo(f).CreationTime) - By File Size:
imageFiles.OrderBy(f => new FileInfo(f).Length) - Zamówienie niestandardowe: Użyj niestandardowej funkcji porównawczej
Następna linia pobierze wszystkie obrazy i połączy je w jeden dokument PDF. Każdy obrazek staje się osobną stroną w pliku PDF.
Jak wydrukować plik PDF?
Poniższy fragment kodu wydrukuje dokument przy użyciu funkcji drukowania IronPDF:
// Print using default printer
doc.Print();
// Print silently (without print dialog)
doc.Print(showPreview: false);
// Print to a specific printer
var printerName = "Microsoft Print to PDF";
doc.Print(printerName);
// Print using default printer
doc.Print();
// Print silently (without print dialog)
doc.Print(showPreview: false);
// Print to a specific printer
var printerName = "Microsoft Print to PDF";
doc.Print(printerName);
' Print using default printer
doc.Print()
' Print silently (without print dialog)
doc.Print(showPreview:=False)
' Print to a specific printer
Dim printerName As String = "Microsoft Print to PDF"
doc.Print(printerName)
Czy mogę określić ustawienia drukarki?
The Print method provided by the PdfDocument class will print the document using the default printer. Oferuje również opcję zmiany nazwy drukarki i innych ustawień. W przypadku zaawansowanych opcji drukowania:
// Advanced printing with settings
using System.Drawing.Printing;
var printDocument = doc.GetPrintDocument();
printDocument.PrinterSettings.PrinterName = "Your Printer Name";
printDocument.PrinterSettings.Copies = 2;
printDocument.PrinterSettings.Collate = true;
printDocument.PrinterSettings.PrintRange = PrintRange.SomePages;
printDocument.PrinterSettings.FromPage = 1;
printDocument.PrinterSettings.ToPage = 3;
printDocument.Print();
// Advanced printing with settings
using System.Drawing.Printing;
var printDocument = doc.GetPrintDocument();
printDocument.PrinterSettings.PrinterName = "Your Printer Name";
printDocument.PrinterSettings.Copies = 2;
printDocument.PrinterSettings.Collate = true;
printDocument.PrinterSettings.PrintRange = PrintRange.SomePages;
printDocument.PrinterSettings.FromPage = 1;
printDocument.PrinterSettings.ToPage = 3;
printDocument.Print();
' Advanced printing with settings
Imports System.Drawing.Printing
Dim printDocument = doc.GetPrintDocument()
printDocument.PrinterSettings.PrinterName = "Your Printer Name"
printDocument.PrinterSettings.Copies = 2
printDocument.PrinterSettings.Collate = True
printDocument.PrinterSettings.PrintRange = PrintRange.SomePages
printDocument.PrinterSettings.FromPage = 1
printDocument.PrinterSettings.ToPage = 3
printDocument.Print()
Aby uzyskać więcej informacji na temat drukowania dokumentów, zapoznaj się z tym przykładem drukowania plików PDF. Możesz również zapoznać się z opcjami drukowania sieciowego dla środowisk Enterprise.
Jakie są najważniejsze wnioski?
W tym samouczku pokazano bardzo prosty sposób konwersji obrazów do pliku PDF wraz z przykładami kodu, zarówno w przypadku konwersji pojedynczego obrazu do formatu PDF, jak i łączenia wielu obrazów w jeden plik PDF. Ponadto wyjaśniono również, jak drukować dokumenty za pomocą jednej linii kodu.
Kluczowe zagadnienia:
- Instalacja IronPDF za pomocą menedżera pakietów NuGet
- Konwersja pojedynczych obrazów do formatu PDF z niestandardowymi ustawieniami
- Konwersja wielu obrazów do jednego pliku PDF
- Kontrola rozmiaru strony, orientacji i marginesów
- Dodawanie metadanych i numerów stron do plików PDF
- Programowe drukowanie plików PDF z opcjami
Ponadto niektóre ważne funkcje IronPDF obejmują:
- Generowanie plików PDF z adresów URL w celu przechwytywania stron internetowych
- Szyfrowanie i deszyfrowanie plików PDF w celu zapewnienia bezpieczeństwa
- Łączenie istniejących plików PDF w celu zarządzania dokumentami
- Tworzenie i edycja formularzy PDF dla dokumentów interaktywnych
- Dodaj znaki wodne w celu budowania marki lub zapewnienia bezpieczeństwa
- Wyodrębnianie tekstu i obrazów z istniejących plików PDF
- Podpisy cyfrowe do uwierzytelniania dokumentów
- Kompresja plików PDF w celu zmniejszenia rozmiarów plików
- Konwersja plików PDF na obrazy w celu utworzenia miniatur
Gdzie mogę dowiedzieć się więcej o IronPDF?
IronPDF oferuje wiele przydatnych funkcji. Zapoznaj się z poniższymi zasobami:
- Odwiedź stronę główną IronPDF, aby zapoznać się z przeglądem produktów
- Przejrzyj obszerną dokumentację, aby uzyskać szczegółowe przewodniki
- Zapoznaj się z przykładami kodu przedstawiającymi praktyczne zastosowania
- Przeczytaj samouczki, aby nauczyć się krok po kroku
- Szczegółowe informacje techniczne można znaleźć w Dokumentacji API
- Dołącz do społeczności IronPDF, aby uzyskać wsparcie
Aby zapoznać się z konkretnymi przypadkami użycia, zajrzyj do:
- Konwersja treści internetowych z HTML do PDF
- Funkcje zabezpieczeń plików PDF zapewniające ochronę
- Optymalizacja wydajności przy dużych operacjach
- Przewodniki wdrażania w chmurze dla platform Azure i AWS
Ile kosztuje IronPDF?
IronPDF jest częścią pakietu Iron Software. Pakiet Iron Suite zawiera dodatkowe przydatne produkty, takie jak IronXL do operacji w programie Excel, IronBarcode do generowania kodów kreskowych, IronOCR do rozpoznawania tekstu oraz IronWebscraper do pozyskiwania danych z sieci. Kupując kompletny pakiet Iron Suite, możesz zaoszczędzić nawet 250%, ponieważ obecnie wszystkie pięć produktów jest dostępnych w cenie zaledwie dwóch. Więcej informacji można znaleźć na stronie ze szczegółami licencji.
IronPDF oferuje:
- Bezpłatna licencja deweloperska do testów
- Professional Licenses already starting at 749 USD
- Bezpłatne opcje redystrybucji bez opłat licencyjnych
- Dostępne licencje SaaS i Licencjonowanie OEM
- 30-dniowa gwarancja zwrotu pieniędzy
- Bezpłatna pomoc techniczna i aktualizacje przez rok
Wypróbuj IronPDF bezpłatnie przez 30 dni dzięki Licencji Trial lub zapoznaj się z opcjami licencyjnymi dla swojego zespołu.
Często Zadawane Pytania
Jak przekonwertować obraz na plik PDF w języku C#?
W języku C# można przekonwertować obraz do formatu PDF za pomocą metody ImageToPdf biblioteki IronPDF. Metoda ta pozwala określić ścieżkę do obrazu oraz żądane ustawienia wyjściowe pliku PDF.
Czy można przekonwertować wiele obrazów do jednego pliku PDF?
Tak, IronPDF umożliwia konwersję wielu obrazów do jednego pliku PDF za pomocą metody ImageToPdf, w której podaje się zbiór plików graficznych.
Jakie formaty obrazów można konwertować do formatu PDF?
IronPDF obsługuje konwersję różnych formatów obrazów, takich jak JPG, PNG, GIF i SVG, do dokumentów PDF.
Jak ustawić rozmiar strony podczas konwersji obrazu do formatu PDF?
Aby ustawić rozmiar strony podczas konwersji, należy użyć właściwości PaperSize w klasie ImageToPdfConverter, aby wybrać standardowy rozmiar, taki jak Letter lub A4.
Czy można wydrukować dokument PDF utworzony za pomocą IronPDF?
Tak, IronPDF zawiera metodę PRINT w klasie PdfDocument, która umożliwia drukowanie dokumentów PDF przy użyciu domyślnych lub określonych ustawień drukarki.
Jakie dodatkowe funkcje oferuje IronPDF?
IronPDF oferuje dodatkowe funkcje, takie jak generowanie plików PDF z adresów URL, szyfrowanie i deszyfrowanie plików PDF, łączenie plików PDF oraz tworzenie i edycja formularzy PDF.
Jak zainstalować IronPDF w projekcie Visual Studio?
Aby zainstalować IronPDF w projekcie Visual Studio, otwórz konsolę menedżera pakietów i uruchom polecenie Install-Package IronPdf.
Jakie są zalety korzystania z IronPDF do generowania plików PDF?
IronPDF oferuje proste, wydajne i dobrze udokumentówane API do generowania plików PDF bez konieczności korzystania z zastrzeżonych interfejsów API. Zapewnia również profesjonalne wsparcie i skutecznie obsługuje różne zadania związane z plikami PDF.
Czy IronPDF jest kompatybilny z .NET 10 i jak mogę go używać do konwersji obrazów do formatu PDF w projekcie .NET 10?
Tak — IronPDF jest w pełni kompatybilny z .NET 10 i od razu obsługuje konwersję obrazów do formatu PDF w projektach .NET 10. Aby z niego skorzystać, zainstaluj pakiet IronPdf NuGet w swoim projekcie .NET 10, a następnie wywołaj metody takie jak ImageToPdfConverter.ImageToPdf("path/to/image.png"), aby przekonwertować pojedynczy obraz, lub przekaż IEnumerable ścieżek do obrazów, aby przekonwertować wiele obrazów. Można również określić opcje, takie jak ImageBehavior lub opcje renderowania za pomocą ChromePdfRenderOptions w celu dostosowania. Działa to tak samo jak w poprzednich wersjach .NET.




