cancel
Showing results for 
Search instead for 
Did you mean: 

PDF to Image Data Item

Hi.

I'm trying to read a PDF file with the skill "Google Computer Vision" the problem is that I don't know how to convert a PDF file to an "Image" Data Item.

I have an object that converts JPG, PNG to Image, but no PDF files, so if anyone can help me with one of these things:
  • Convert a PDF file directly to "Image" Data Item
  • or
  • Convert a PDF file to a JPG file but directly in Blue Prism (with an object or a code in C#)
26531.jpg

I really appreciate it. Thanks


------------------------------
Nicolás Wilches Salazar
RPA Developer
EY
America/Bogota
------------------------------
1 REPLY 1

GopalBhaire
Level 10

You can use PdfiumViewer https://github.com/pvginkel/PdfiumViewer

You'll have to copy PdfiumViewer.dll and pdfium.dll (in x86 or x64 folder) to BP directory and add reference to PdfiumViewer.dll in BP 

Global code

static void Go(string pdfFile, string saveFolder)
{
	using (var pdfDocument = PdfiumViewer.PdfDocument.Load(pdfFile))
	{
		for(int index = 0; index < pdfDocument.PageCount; index++)
		{
			 var image = pdfDocument.Render(index,300,300, true);
			 image.Save(saveFolder+"Page_"+index.ToString()+".png", ImageFormat.Png);
		}
	}
}


------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------