Elina
Elina

Reputation: 139

How to convert pdf to Image using c# code?

I have a requirement like whenever user will upload a pdf file into SharePoint online document library,i have to read the first page of pdf file and convert into thumbnail image and save back to SharePoint library using Azure functions.

Is there any example code OR open source.

I have tried PdftoPng (https://www.nuget.org/packages/Pdf2Png/) But in azure function not able to install the packege its giving error (Package Pdf2Png 1.0.2 is not compatible with net461 (.NETFramework,Version=v4.6.1). Package Pdf2Png 1.0.2 does not support any target frameworks). (Install-Package Pdf2Png -Version 1.0.2).

Is there any other way around to achieve this.Please suggest.

Upvotes: 2

Views: 6611

Answers (1)

Leo Chapiro
Leo Chapiro

Reputation: 13979

The documentation of Pdf2Png says:

A x86 simple library based on .net 4.5.2, .net 4.5.1, and .net 4.0 to convert pdf to image for .net.

So you need to change your target framework to 4.51 or 4.5.2 - that's all!

Upvotes: 2

Related Questions