I think this is because it is a C++ lib.
NativeBoost cannot be used with C++ lib. 
It is a problem of call convention that is not the same from C to C++. 
As I discuss with some people it seems be a complexe problem, each C++ compiler 
seems have it own convention. 
But Igor can maybe be more accurate about that.
A C wrapper to call C++, which should work.

On 23 May 2014, at 02:36, Torsten Bergmann <[email protected]> wrote:

> Hi, 
> 
> as there was no responded so far I tried to track the problem deeper and did 
> a short test
> client in C/C++ to verify if I can call WKHTMLTOPDF there and generate a PDF 
> and to 
> compare to the Pharo/NativeBoost client. 
> 
> Attached is the according CPP file which works and results in a PDF with the 
> google 
> homepage. 
> 
> I also additionally implemented the callback functions in the Pharo wrapper 
> and 
> using the error handling I noticed that the component returns "Failed loading 
> page http:// ..."
> 
> 
> With that info I compared the C/C++ calls to the Pharo/NativeBoost calls more 
> deeply and 
> found out that in C/C++ the following call for an object setting works (by 
> returning 1):
> 
> 
>        // this returns 1 in C/C++ which is OK
>       int a = wkhtmltopdf_set_object_setting(os, "page", 
> "http://www.google.de";);
>       printf("object set %i",a);
> 
> 
> while in Pharo the same call fails (by returning 0):
> 
>        "The following call failed and returns 0 instead of 1"
>       self setObjectSetting: 'page' to: 'http://www.google.de' in: os.
> 
> I checked how I wrapped this API call again and again - it is fine from my 
> side:
> 
>    setObjectSetting: aName to: value in: settings
> 
>       <primitive: #primitiveNativeCall module: #NativeBoostPlugin>
> 
>        ^NBFFICallout stdcall: #(int 
> wkhtmltopdf_set_object_setting(wkhtmltopdf_object_settings* settings, char* 
> aName, char* value)) module: 'wkhtmltox.dll'  
> 
> and I still have no idea why it fails. 
> 
> Especially because "wkhtmltopdf_set_object_setting" function is not different 
> from "wkhtmltopdf_set_global_setting" which is exactly the same way wrapped, 
> works 
> and returns 1 in exactly the same example.
> 
> I would really appreciate if someone could have a second look...
> 
> To reproduce on Windows:
> 
> 1. Download the 32 bit version of WKHTML from http://wkhtmltopdf.org and 
> install it
> 2. Copy the "wkhtmltox.dll" to either the folder of the VM executable
>    or the Windows directory so it can be found
> 3. Load the package WKHTML2PDF-Core-TorstenBergmann.7 
>    from http://smalltalkhub.com/#!/~TorstenBergmann/WKHTML2PDF into Pharo 
> 3.0#30848
> 4. Check the Transcript while evaluating:
> 
>        WKPDFLibrary example
> 
>    One can see that within this code #setObjectSetting:to:in: fails while 
> #setGlobalSetting:to:in:
>    works.
> 
> Maybe I just do not see the obvious. Help is appreciated. Thanks in advance!
> 
> bye
> T.
> 
> 
> <main.cpp>

Best Regards
Jean Baptiste Arnaud
[email protected]







Reply via email to