2

At work I have encountered a problem with EvoPdf for DotNet client where it won't actually convert the html because of the following exception:

An error occured. Initialization failed: Insufficient data 

The stack trace shows the following:

 at am.aa()
   at EvoPdf.HtmlToPdfClient.HtmlToPdfConverter.ConvertHtml(String html, String baseUrl)
   at evoPdfTest.Program.Main(String[] args) in D:\git\evoPdfTest\evoPdfTest\Program.cs:line 32

This of course makes no sense, because in order to verify it wasn't anything I did, I decided to make a small console app as follows (also this same error occurs in their demo code as well.

var pdfConverter = new HtmlToPdfConverter(myIpString, myPort);
var paragraphHtml = $$"<!DOCTYPE html><html> <body> The content of the body element is displayed in your browser.</body></html> "";
pdfConverter.LicenseKey = myKey;


// Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed
// Set this property to 0 if you don't need to wait for such asynchcronous operations to finish
pdfConverter.ConversionDelay = 2;


// set PDF page size
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;

// set PDF page orientation
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Portrait;

var pdfBytes = pdfConverter.ConvertHtml(paragraphHtml, null);

Where am I going wrong, and is this just a case of a superemly poorly written error message?

mjwills
  • 23,389
  • 6
  • 40
  • 63
SomeStudent
  • 2,856
  • 1
  • 22
  • 36
  • EvoPdf is commercial software, checking the tag most of these questions go unanswered, i would suggest using the support channel of the manufacturer/developers – TheGeneral Feb 06 '19 at 02:29
  • Given the .NET Framework package works, and the .NET Core doesn't, is it an option to change your program to use .NET Framework? – mjwills Feb 06 '19 at 02:53
  • 1
    Sadly not, as the location where it resides in is a full .NET Core project as we are moving away from the MVC framework. That said, in a full .net console app the parameterless pdfconverter and calling the method works fine. – SomeStudent Feb 06 '19 at 02:57
  • 1
    Ya know, I think I figured it out, and I might chew out my CTO. The man used some god forsaken variant of the nuget, and when we rewrote it we didn't get the right one. – SomeStudent Feb 06 '19 at 03:08

1 Answers1

2

For anyone getting this error in the future:

An error occured. Initialization failed: Insufficient data

This occurs due to a mismatch in versions. In our case, we had an Azure Function running version 8.0.0 of the EvoPDF NuGet library and an Azure Cloud Application endpoint running version 7.5.0. Ensure that all services are running the same version.

Christian Coan
  • 97
  • 1
  • 12
  • This was our problem, we decided to go with dinkToPdf in the end instead. Free and does what we need – SomeStudent Feb 03 '20 at 14:45
  • This happens if you have different version of client and service installed. In my case I had Evo .Net Core Client Nuget v8.0.0 but Evo PDF service - v7.5.6 installed. Later updated the Evo PDF Service to v8.0.0. Issue resolved. Hope this helps someone. – fingers10 Nov 17 '20 at 15:19