Migrate PDF library from .NET Framework to .NET Core
2 Mar 20235 minutes to read
In this section, we will see about the changes which need to be considered while migrating Syncfusion .NET PDF library from .NET Framework to .NET Core.
NuGet packages
Packages targeting .NET Framework | Packages targeting .NET Standard 2.0/.NET Core |
---|---|
|
Class changes
Missing classes | Alternate classes |
---|---|
You can open the document as stream from the system file using API. | |
You can open the encrypted document as stream or byte array with password from system file using or API. | |
You can open the corrupted PDF document as stream or byte array with Boolean from system file using or API. | |
TextLineCollection *Sample link:* |
|
PdfTiffImage *Sample link:* |
|
XPSToPdfConverter *Sample link:* |
|
PdfCompressionOptions *Sample link:* |
|
Not supported | |
Not supported | |
- Add/modify JavaScript actions on existing PDF document | Not supported |
You can check whether the existing PDF document is corrupted or not using . | |
Not supported | |
Not supported | |
BarcodeException | |
Not supported | |
Not supported | |
PdfRichMediaContent(String, Stream, String, PdfRichMediaContentType) |
|
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported | |
TextLineCollection *Sample link:* |
|
Not supported | |
PdfLayoutFormat *Sample link:* |
|
Not supported | |
Not supported | |
Not supported |
Method changes
Missing methods | Alternate methods |
---|---|
ExtractText(out TextLineCollection textLineCollection) *Sample link:* |
|
ExtractImages *Sample link:* |
|
ExportAsImage() *Sample link:* |
|
AddRedaction(PdfRedaction) - Additionally, call the following method to execute the redaction. PdfLoadedDocument.Redact(); *Sample link:* |
|
ToImage() | |
Barcode.ToImage(SizeF size) *Sample link:* |
|
Not supported due to .NET Core framework limitations. Alternatively, this can be achieved by . | |
Not supported due to .NET Core framework limitations. Alternatively, this can be achieved by using
.
|
|
Merge(PdfDocumentBase, Stream[]) *Sample link:* |
|
Merge(PdfDocumentBase, Stream[]) *Sample link:* |
|
Merge(PdfDocumentBase, PdfMergeOptions, Object[]) - Object[] in the form of Stream[]. | |
PdfSoundAction(Stream) | |
PdfSoundAnnotation(RectangleF, Stream) | |
PdfTrueTypeFont(Stream) | |
PdfTrueTypeFont(Stream, int) | |
Not supported | |
Not supported | |
Not supported | |
RemoveImage(PdfImageInfo[]) *Sample link:* |
|
ReplaceImage(Int32, PdfImage) *Sample link:* |
|
CreateBooklet(PdfLoadedDocument, SizeF) | |
CreateBooklet(PdfLoadedDocument, SizeF, Boolean) | |
You can save the document as stream to the file system using API. | |
Not supported | |
Not supported | |
Draw(PdfPage, PointF, Single, Single, PdfLayoutFormat) | |
Draw(PdfPage, RectangleF, PdfLayoutFormat) | |
Draw(PdfPage, PointF, Single, PdfLayoutFormat) | |
Draw(PdfPage, PointF, Single, Single, PdfMetafileLayoutFormat) |
Draw(PdfPage, PointF, Single, Single, PdfLayoutFormat) |
Draw(PdfPage, RectangleF, PdfLayoutFormat) | |
Not supported |
Property changes
Missing properties | Alternate properties |
---|---|
GetImagesInfo() *Sample link:* |
|
ConvertToPDFA(PdfConformanceLevel.Pdf_A1B) *Sample link:* |
|
Not supported | |
Pdf_X1A2001 through | Not supported |
[PdfGrid.DataSource (IEnumerable - In ASP.NET Core, only the strongly typed IEnumerable objects are supported. |
|
PdfLoadedDocument.CompressionOptions = PdfCompressionOptions |
PdfLoadedDocument.Compress(PdfCompressionOptions) *Sample link:* |
- Enum | Not supported |
Not supported | |
Not supported | |
Not supported | |
AddRedaction(PdfRedaction) - Additionally, call the following method to execute the redaction. PdfLoadedDocument.Redact(); *Sample link:* |
|
GetImagesInfo() *Sample link:* |
|
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported | |
Not supported |
Event changes
Missing events | Alternate events |
---|---|
FontNotFoundEventArgs | Not supported |
ImagePreRenderEventArgs | Not supported |
Not supported |
Advantages
- Cross-platform compatibility: ASP.NET Core can run on Windows, MacOS, and Linux, making it a flexible option for developing web applications.
- Integration with cloud services: ASP.NET Core can be easily integrated with cloud services, such as Microsoft Azure, Amazon Web Services, Docker and Google Cloud Platform.
Known limitations
- EMF and WMF images are not supported on the .NET Core platform.
Notable changes
- For text measuring and graphics operations in the .NET Framework, our library utilizes System.Drawing. In contrast, for similar graphics operations in .NET Core, our library employs Syncfusion.Drawing.
- The following features utilize the NuGet package Syncfusion.Pdf.Imaging.Net.Core Which is separate from Syncfusion.Pdf.Net.Core NuGet package.
- For converting XPS to PDF document, kindly utilize the Syncfusion.XpsToPdfConverter.Net.Core NuGet package in your ASP.NET Core application.
- To convert PDF to image, please use the Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows NuGet package in your ASP.NET Core application.
NOTE
If you want to migrate without any code changes from Syncfusion.Pdf.AspNet NuGet in application targeting .NET Framework, you can consider using anyone of the following packages:
- Syncfusion.Pdf.WinForms
- Syncfusion.Pdf.Wpf
- Syncfusion.Pdf.AspNet.Mvc4
- Syncfusion.Pdf.AspNet.Mvc5
- But this is not a recommended approach.