BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi,
how can i get a
List<Bitmap> images = new List<Bitmap>();
from the pages of a pdf document?
I found your solution on PDF to Image conversion in Azure functions | ASP.NET Core - PDF Viewer (syncfusion.com) but for net.core console apps seems not the right way.
Please refer to the below UG documentation to export the PDF document as pages:
code sample:
//Uses the Syncfusion.EJ2.PdfViewer assembly PdfRenderer pdfExportImage = new PdfRenderer(); //Loads the PDF document pdfExportImage.Load(@"currentDirectory\..\..\..\..\Data\HTTP Succinctly.pdf"); //Exports the PDF document pages into images Bitmap bitmapimage = pdfExportImage.ExportAsImage(0); //Save the exported image in disk bitmapimage.Save(@"currentDirectory\..\..\..\..\Images\" + "bitmapImage" + i.ToString() + ".png"); |
We have attached a sample to achieve your requirement on your end. Please try this on your end and let us know the result.
Hi
thx for your response.
Same problem on your code sample:
I need a Bitmap Object but on this line
Bitmap bitmapimage = pdfExportImage.ExportAsImage(0);
the result is a SKBitmap and not a System.Drawing.Bitmap,
.NET 6 standards have support for System. Drawing only in Windows platform. So, we have migrated to the Skaisharp for .Net 6 and above. If your .NET Version is below 6.0, then you can make use of this code.
//Uses the Syncfusion.EJ2.PdfViewer assembly PdfRenderer pdfExportImage = new PdfRenderer(); //Loads the PDF document pdfExportImage.Load(@"currentDirectory\..\..\..\..\Data\HTTP Succinctly.pdf"); //Exports the PDF document pages into images Bitmap bitmapimage = pdfExportImage.ExportAsImage(0); //Save the exported image in disk bitmapimage.Save(@"currentDirectory\..\..\..\..\Images\" + "bitmapImage" + i.ToString() + ".png"); |