NReco.ImageGenerator failed to generate image from file - c#

i'm trying to create jpg files from html using NReco.ImageGenerator nuget.
i'm using function 'GenerateImageFromFile', in most cases the generation works fine, in other cases the dll throws me:
'An unhandled exception of type 'System.Exception' occurred in NReco.ImageGenerator.dll
Additional information: Image generation failed: Exit with code 1 due to network error: ContentNotFoundError'
i'll be glad to hear your opinion, any solution will be appreciated.
Thanks guys.

NReco uses an open source program called "wkhtmltopdf" (you can find it on https://github.com/wkhtmltopdf/wkhtmltopdf).
After run your application the .dll puts the "wkhtmltoimage.exe" in the path, in my case when I run the "wkhtmltoimage.exe" it asks for a .dll, in the majority of the cases you just need install the Visual C++ redistributable package (http://www.microsoft.com/en-us/download/confirmation.aspx?id=40784)

Since ImageGenerator is a .net wrapper for wkhtmltoimage you can apply the following command line option to ignore content load errors:
var htmlToImage = new NReco.ImageGenerator.HtmlToImageConverter();
var htmlToImage.CustomArgs = " --load-error-handling ignore ";
With this option wkhtmltoimage will ignore errors when referenced resource (js,css,images etc) cannot be downloaded.
Ederson's answer about VC++ runtime libs is correct for case if ImageGenerator throws an exception for any input (error message is "The pipe has been ended" or "Image generation failed: (exit code: 255)").

Related

(MT5210) Native linking failed, undefined symbol: _GULIsLoggableLevel. Xamarin.iOS

Today I try to download from nuget package manager MarcTron to use Ads in my app and when I try to run the project in debug mode I receive this error:
Error MT5210: Native linking failed, undefined symbol: _GULIsLoggableLevel. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210) (WeatherLocationInfo.iOS)
Another error is:
APMMeasurement networkUploadCompletionHandlerWithResponse: Error: ] in GoogleAppMeasurement(APMMeasurement_7b399ffe8f030717675febfa49640b5b.o) (WeatherLocationInfo.iOS)
When I delete the library everything is ok.
The same error I receive when I try to download Xamarin.Google.iOS.MobileAds.
How can I fix this issues ?

I am unable to use Nuget Nlua to read .lua file in C#

Using visual studio with class application I added the NLua via NuGet.
I want to read in and .lua file (BTW, of there is a better way do let me know)
My code is this:
...
using NLua;
...
using (Lua lua = new Lua())...
But when I run it I get an exception on the above line:
System.BadImageFormatException
HResult=0x8007000B
Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
Source=KeraLua
StackTrace:
at KeraLua.NativeMethods.luaL_newstate()
at NLua.Lua..ctor()
What am I doing wrong? I tried to search the internet and came up with solutions that it is since I am running a 64bit app while the one I am trying to load (NLUA) in 32bit.
Is that it?
THANK YOU

The type initializer for 'WebSupergoo.ABCpdf7.Internal.NDoc' threw an exception

I have installed a software ABCPDF7, which converts a html file to pdf and saves it.
I am facing an error:
ERROR MESSAGE :The type initializer for 'WebSupergoo.ABCpdf7.Internal.NDoc' threw an exception. ERROR DETAILS : at WebSupergoo.ABCpdf7.Internal.NDoc.New() at WebSupergoo.ABCpdf7.Doc..ctor()
on line :
WebSupergoo.ABCpdf7.Doc oDoc = new WebSupergoo.ABCpdf7.Doc();
======
This error is coming in one old application.
So for cross checking I did create a dummy app, and executed the code in same box and everything worked fine.
Any idea where is it failing in existing app?
ABCpdf7 requires two DLLs to be accessible: ABCPDF.DLL and ABCPDFCE7.DLL. Both must be the same version (down to the minor release number) and also must both match the bitness of the machine they are running on (32-bit or 64-bit).
Perhaps one of the DLLs in the old application is incorrect.
If you are facing this issue after Deployment , The issue could be Application Pool . It need to be configured to enable 32 bit Application . Please see attached (Embedded) Screenshot:
https://i.stack.imgur.com/MkZpA.png

Issue with Microsoft Enterprise Library 5.0 and custom powershell cmdlet

I'm creating a custom powershell 1.0 cmdlet that will allow me to feed exceptions from powershell scripts to the Microsoft Enterprise Library v5.0 exception handling block.
I load up my Exception handling config from an external file since the cmdlet is compiled into a dll, and then try to create an instance of ExceptionManager using the config.
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource config =
new Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource(configFile);
WriteDebug("Config loaded from " + Path.GetFullPath(configFile));
EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(config);
exManager = EnterpriseLibraryContainer.CreateDefaultContainer(config).GetInstance<ExceptionManager>();
This fails when I call my command from powershell with the following error:
Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type ExceptionManager, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManager", name = "(none)".
Exception occurred while: while resolving. Exception is: InvalidOperationException - The type ExceptionManager cannot be constructed. You must configure the container to supply this value.
The frustrating thing is that the code works perfectly fine when used in a stand-alone console application with the exact same configuration. I'm not really sure why I'm getting this error; I've made sure that I'm using the same assemblies that are referenced in the config file and I've made sure that I'm referencing all the necessary enterprise library dlls in my project.
Additionally, I've had to copy the Enterprise Library dlls into the powershell install directory (%SystemRoot%\system32\WindowsPowerShell\v1.0), otherwise I would receive FileNotFoundExceptions about not being able to find the correct library while the configuration file was being processed. I don't have too much experience with powershell or enterprise library, but I'm guessing that this might be resolved by playing around with AppDomain settings.
Turns out I wasn't giving an absolute path to my configuration file, which was causing weirdness. I originally just set it to "widgit.dll.config", and threw it under %systemroot%\System32, since that's the default working directory of my powershell, and seemed to get rid of the initial "file not found" errors I was having (didn't want to change the working directory until I understood the entire problem). On a hunch, I copied the config into the powershell directory and renamed it powershell.exe.config, and that solved my other problem.
Putting stuff into system directories isn't the most elegant solution at this point, but it's sufficient for my current problem.

App_GlobalResources Compilation Error on Apache

I wrote an ASP.NET application and am running it on apache with mod mono. I get this error when trying to run it. It runs fine in Visual Studio and Mono Develop
Compilation Error
Description: Error compiling a resource required to service this request. Review your source file and modify it to fix this error.
Compiler Error Message:
App_GlobalResources.383ec40d.resources.dll
I have resx files in App_GlobalResources. Not sure why I am getting this.
I am not sure what caused the original problem but I did get around it by precompilling my webapp using:
aspnet_compiler -p physicalOrRelativePath -v / targetPath

Categories

Resources