DinkToPdf
DinkToPdf copied to clipboard
Support Xamarin.Android
I'm trying to use this library on Xamarin.Android but I think that the libwkhtmltox.so
might not be supported for the different ABIs of Android.
At least, I've tried with x86 (given that I'm trying on an emulator) and I can't get this to work.
I've added the android native reference to the library but it keeps throwing DLLNotFoundException pointing out to libwkhtmltox.
This is how my Android *.csproj android native library looks like:
<AndroidNativeLibrary Include="lib\x86\libwkhtmltox.so" />
Also tried to set the file as "Copy Always", but it didn't work.
Something that I think is worth noticing is that the application output shows:
[Mono] DllImport attempting to load: 'libwkhtmltox'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.whatever.app/files/.__override__/libwkhtmltox': '(null)'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.whatever.app/files/.__override__/libwkhtmltox.so': '(null)'.
[Mono] DllImport error loading library '/storage/emulated/0/Android/data/com.whatever.app/files/.__override__/libwkhtmltox.so': '(null)'.
[Mono] DllImport error loading library '/system/lib/libwkhtmltox': '(null)'.
[Mono] DllImport error loading library '/system/lib/libwkhtmltox.so': '(null)'.
[Mono] DllImport error loading library '/system/lib/libwkhtmltox.so': '(null)'.
[Mono] DllImport error loading library 'libwkhtmltox': '(null)'.
[Mono] DllImport error loading library 'libwkhtmltox.so': 'dlopen failed: library "libXrender.so.1" not found'.
[Mono] DllImport error loading library 'libwkhtmltox.so': 'dlopen failed: library "libXrender.so.1" not found'.
[Mono] DllImport error loading library 'libwkhtmltox': '(null)'.
[Mono] DllImport unable to load library '(null)'.
So maybe the libXrender
needs to be also referenced in order to load the libwkhtmltox.so
file.
Am I missing something or is the *.so file not prepared to work with the different ABIs of Android?
@fedemkr Have you found a way to use this lib on android? I have a Unity/Android app and would wery much like to make this work to avoid using a cloud web api just to convert html to A4 pdf-s. As I see it the problem is the native libwkhtmltox.dll that is built for windows platforms. But maybe if we tryed something built for linux ??
I've tried with the version for linux and I couldn't make it work. I think it's necessary to build the libwkhtmltox for the different ABIs of Android using CMAKE. Particularly, in my project is no longer needed and now I don't have enough spare time to make it work. But in the future if it's still needed and I have the time, I'll come back to see if I can get it done.