How to convert a PDFImage to Byte

Hello


I am trying to save or convert a PDFImage to a byte[] in order to save the image to a SQL database. I cant work out how to save the PDFImage to a memory stream so I can then convert to a byte[] via ms.ToArray(). If I try pdfimage.save(ms) it says that type PDFImage is inaccessible due to its protection level.

thanks

scott


3 Replies 1 reply marked as answer

KS Karmegam Seerangan Syncfusion Team October 16, 2023 02:02 PM UTC

Hi Thomson,


We lack the capability to store PdfImage as image data. The PdfImage/PdfBitmap API is exclusively designed for embedding images within a PDF document. If you wish to save the image as a standalone file in your database, you can achieve this by converting the original image file into a byte[] array. Alternatively, if your goal is to export the PDF as an image, our ExportAsImage API can be employed to obtain the resulting image stream. This stream can then be directly uploaded to your database.


Regards,

Karmegam



Marked as answer

ST s thomson October 17, 2023 08:04 PM UTC

thank you Karmegam this will be very useful



SS Swetha Srikumar Syncfusion Team October 18, 2023 06:13 AM UTC

Most welcome, please get back to us if you need any assistance.



Loader.
Up arrow icon