Browse Source

Update c-api and add example

Antialize 15 years ago
parent
commit
f2d773fef1

+ 15 - 0
examples/Makefile

@@ -0,0 +1,15 @@
+CFLAGS= -I ../include 
+LDFLAGS=-L ../bin -lwkhtmltox -Wall -ansi -pedantic
+
+EXES=pdf_c_api
+
+all: $(EXES)
+
+.PHONY: clean run all
+
+run: $(EXES)
+	LD_LIBRARY_PATH=../bin ./pdf_c_api
+
+clean:
+	$(RM) $(EXES)
+

+ 112 - 0
examples/pdf_c_api.c

@@ -0,0 +1,112 @@
+/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+ * vi:set ts=4 sts=4 sw=4 noet :
+ *
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
+
+/* This is a simple example program showing how to use the wkhtmltopdf c bindings */
+#include <stdbool.h>
+#include <stdio.h>
+#include <wkhtmltox/pdf.h>
+
+/* Print out loading progress information */
+void progress_changed(wkhtmltopdf_converter * c, int p) {
+	printf("%3d%%\r",p);
+	fflush(stdout);
+}
+
+/* Print loading phase information */
+void phase_changed(wkhtmltopdf_converter * c) {
+	int phase = wkhtmltopdf_current_phase(c);
+	printf("%s\n", wkhtmltopdf_phase_description(c, phase));
+}
+
+/* Print a message to stderr when an error occures */
+void error(wkhtmltopdf_converter * c, const char * msg) {
+	fprintf(stderr, "Error: %s\n", msg);
+}
+
+/* Print a message to stderr when a warning is issued */
+void warning(wkhtmltopdf_converter * c, const char * msg) {
+	fprintf(stderr, "Warning: %s\n", msg);
+}
+
+/* Main method convert pdf */
+int main() {
+	wkhtmltopdf_global_settings * gs;
+	wkhtmltopdf_object_settings * os;
+	wkhtmltopdf_converter * c;
+
+	/* Init wkhtmltopdf in graphics less mode */
+	wkhtmltopdf_init(false);
+
+	/*
+	 * Create a global settings object used to store options that are not
+	 * related to input objects, note that control of this object is parsed to
+	 * the converter later, which is then responsible for freeing it
+	 */
+	gs = wkhtmltopdf_create_global_settings();
+	/* We want the result to be storred in the file called test.pdf */
+	wkhtmltopdf_set_global_setting(gs, "out", "test.pdf");
+
+	/*
+	 * Create a input object settings object that is used to store settings
+	 * related to a input object, note again that control of this object is parsed to
+	 * the converter later, which is then responsible for freeing it
+	 */
+	os = wkhtmltopdf_create_object_settings();
+	/* We want to convert to convert the qstring documentation page */
+	wkhtmltopdf_set_object_setting(os, "page", "http://doc.trolltech.com/4.6/qstring.html");
+
+	/* Create the actual converter object used to convert the pages */
+	c = wkhtmltopdf_create_converter(gs);
+
+	/* Call the progress_changed function when progress changes */
+	wkhtmltopdf_set_progress_changed_callback(c, progress_changed);
+
+	/* Call the phase _changed function when the phase changes */
+	wkhtmltopdf_set_phase_changed_callback(c, phase_changed);
+
+	/* Call the error function when an error occures */
+	wkhtmltopdf_set_error_callback(c, error);
+
+	/* Call the waring function when a warning is issued */
+	wkhtmltopdf_set_warning_callback(c, warning);
+
+	/*
+	 * Add the the settings object describing the qstring documentation page
+	 * to the list of pages to convert. Objects are converted in the order in which
+	 * they are added
+	 */
+	wkhtmltopdf_add_resource(c, os, NULL);
+
+	/* Perform the actual convertion */
+	if (!wkhtmltopdf_convert(c))
+		fprintf(stderr, "Convertion failed!");
+
+	/* Output possible http error code encountered */
+	printf("httpErrorCode: %d\n", wkhtmltopdf_http_error_code(c));
+
+	/* Destroy the converter object since we are done with it */
+	wkhtmltopdf_destroy_converter(c);
+
+	/* We will no longer be needing wkhtmltopdf funcionality */
+	wkhtmltopdf_deinit();
+
+	return 0;
+}

+ 25 - 15
include/wkhtmltox/dllbegin.inc

@@ -1,16 +1,22 @@
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/*
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
+
 #ifndef __WKHTMLTOPDF_DLLBEGIN__
 #define __WKHTMLTOPDF_DLLBEGIN__
 
@@ -31,6 +37,10 @@
   #endif
 #endif
 
-#define CAPI extern "C" DLL_PUBLIC
+#ifdef __cplusplus
+  #define CAPI extern "C" DLL_PUBLIC
+#else
+  #define CAPI DLL_PUBLIC
+#endif
 
-#endif //__WKHTMLTOPDF_DLLBEGIN__
+#endif /*__WKHTMLTOPDF_DLLBEGIN__*/

+ 20 - 15
include/wkhtmltox/dllend.inc

@@ -1,16 +1,22 @@
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/*
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
+
 #ifdef __WKHTMLTOPDF_DLLBEGIN__
 
 #undef __WKHTMLTOPDF_DLLBEGIN__
@@ -18,5 +24,4 @@
 #undef DLL_LOCAL
 #undef CAPI
 
-#endif //__WKHTMLTOPDF_DLLBEGIN__
-
+#endif /*__WKHTMLTOPDF_DLLBEGIN__*/

+ 29 - 24
include/wkhtmltox/image.h

@@ -1,19 +1,21 @@
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/*
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
 
 #ifndef __IMAGE_H__
 #define __IMAGE_H__
@@ -27,9 +29,12 @@ typedef struct wkhtmltoimage_converter wkhtmltoimage_converter;
 
 typedef void (*wkhtmltoimage_str_callback)(wkhtmltoimage_converter * converter, const char * str);
 typedef void (*wkhtmltoimage_int_callback)(wkhtmltoimage_converter * converter, const int val);
-typedef void (*wkhtmltoimage_bool_callback)(wkhtmltoimage_converter * converter, const bool val);
 typedef void (*wkhtmltoimage_void_callback)(wkhtmltoimage_converter * converter);
 
+CAPI int wkhtmltoimage_init(int useGraphics);
+CAPI int wkhtmltoimage_deinit();
+CAPI int wkhtmltoimage_extended_qt();
+
 CAPI wkhtmltoimage_global_settings * wkhtmltoinage_create_global_settings();
 
 CAPI int wkhtmltoimage_set_global_option(wkhtmltoimage_global_settings * settings, const char * name, const char * value);
@@ -38,13 +43,13 @@ CAPI int wkhtmltoimage_get_global_option(wkhtmltoimage_global_settings * setting
 CAPI wkhtmltoimage_converter * wkhtmltoimage_create_converter(wkhtmltoimage_global_settings * settings);
 CAPI void wkhtmltoimage_destroy_converter(wkhtmltoimage_converter * converter);
 
-CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb);
-CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb);
-CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback * cb);
-CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback * cb);
-CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_bool_callback * cb);
+CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
+CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
+CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback cb);
+CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
+CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
 CAPI void wkhtmltoimage_begin_convertion(wkhtmltoimage_converter * converter);
-CAPI bool wkhtmltoimage_convert(wkhtmltoimage_converter * converter);
+CAPI int wkhtmltoimage_convert(wkhtmltoimage_converter * converter);
 CAPI void wkhtmltoimage_cancel(wkhtmltoimage_converter * converter);
 
 CAPI int wkhtmltoimage_current_phase(wkhtmltoimage_converter * converter);
@@ -54,4 +59,4 @@ CAPI const char * wkhtmltoimage_progress_string(wkhtmltoimage_converter * conver
 CAPI int wkhtmltoimage_http_error_code(wkhtmltoimage_converter * converter);
 
 #include <wkhtmltox/dllend.inc>
-#endif //__IMAGE_H__
+#endif /*__IMAGE_H__*/

+ 34 - 30
include/wkhtmltox/pdf.h

@@ -1,19 +1,21 @@
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/*
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
 
 #ifndef __PDF_H__
 #define __PDF_H__
@@ -28,34 +30,36 @@ typedef struct wkhtmltopdf_object_settings wkhtmltopdf_object_settings;
 struct wkhtmltopdf_converter;
 typedef struct wkhtmltopdf_converter wkhtmltopdf_converter;
 
-
 typedef void (*wkhtmltopdf_str_callback)(wkhtmltopdf_converter * converter, const char * str);
 typedef void (*wkhtmltopdf_int_callback)(wkhtmltopdf_converter * converter, const int val);
-typedef void (*wkhtmltopdf_bool_callback)(wkhtmltopdf_converter * converter, const bool val);
 typedef void (*wkhtmltopdf_void_callback)(wkhtmltopdf_converter * converter);
 
+CAPI int wkhtmltopdf_init(int useGraphics);
+CAPI int wkhtmltopdf_deinit();
+CAPI int wkhtmltopdf_extended_qt();
+
 CAPI wkhtmltopdf_global_settings * wkhtmltopdf_create_global_settings();
 CAPI wkhtmltopdf_object_settings * wkhtmltopdf_create_object_settings();
 
-CAPI int wkhtmltopdf_set_global_option(wkhtmltopdf_global_settings * settings, const char * name, const char * value);
-CAPI int wkhtmltopdf_get_global_option(wkhtmltopdf_global_settings * settings, const char * name, char * value, int vs);
-CAPI int wkhtmltopdf_set_object_option(wkhtmltopdf_object_settings * settings, const char * name, const char * value);
-CAPI int wkhtmltopdf_get_object_option(wkhtmltopdf_object_settings * settings, const char * name, char * value, int vs);
+CAPI int wkhtmltopdf_set_global_setting(wkhtmltopdf_global_settings * settings, const char * name, const char * value);
+CAPI int wkhtmltopdf_get_global_setting(wkhtmltopdf_global_settings * settings, const char * name, char * value, int vs);
+CAPI int wkhtmltopdf_set_object_setting(wkhtmltopdf_object_settings * settings, const char * name, const char * value);
+CAPI int wkhtmltopdf_get_object_setting(wkhtmltopdf_object_settings * settings, const char * name, char * value, int vs);
 
 
 CAPI wkhtmltopdf_converter * wkhtmltopdf_create_converter(wkhtmltopdf_global_settings * settings);
 CAPI void wkhtmltopdf_destroy_converter(wkhtmltopdf_converter * converter);
 
-CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb);
-CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb);
-CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback * cb);
-CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback * cb);
-CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_bool_callback * cb);
+CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
+CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
+CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback cb);
+CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
+CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
 CAPI void wkhtmltopdf_begin_convertion(wkhtmltopdf_converter * converter);
-CAPI bool wkhtmltopdf_convert(wkhtmltopdf_converter * converter);
+CAPI int wkhtmltopdf_convert(wkhtmltopdf_converter * converter);
 CAPI void wkhtmltopdf_cancel(wkhtmltopdf_converter * converter);
 CAPI void wkhtmltopdf_add_resource(
-	wkhtmltopdf_converter * converter, wkhtmltopdf_object_settings * setting, const char * data=0);
+	wkhtmltopdf_converter * converter, wkhtmltopdf_object_settings * setting, const char * data);
 
 CAPI int wkhtmltopdf_current_phase(wkhtmltopdf_converter * converter);
 CAPI int wkhtmltopdf_phase_count(wkhtmltopdf_converter * converter);
@@ -64,4 +68,4 @@ CAPI const char * wkhtmltopdf_progress_string(wkhtmltopdf_converter * converter)
 CAPI int wkhtmltopdf_http_error_code(wkhtmltopdf_converter * converter);
 
 #include <wkhtmltox/dllend.inc>
-#endif //__PDF_H__
+#endif /*__PDF_H__*/

+ 22 - 17
src/lib/dllbegin.inc

@@ -1,19 +1,24 @@
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+ * vi:set ts=4 sts=4 sw=4 noet :
+ *
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
+
 #ifndef __WKHTMLTOPDF_DLLBEGIN__
 #define __WKHTMLTOPDF_DLLBEGIN__
 
@@ -40,4 +45,4 @@
   #define CAPI DLL_PUBLIC
 #endif
 
-#endif //__WKHTMLTOPDF_DLLBEGIN__
+#endif /*__WKHTMLTOPDF_DLLBEGIN__*/

+ 22 - 18
src/lib/dllend.inc

@@ -1,19 +1,24 @@
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+ * vi:set ts=4 sts=4 sw=4 noet :
+ *
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
+
 #ifdef __WKHTMLTOPDF_DLLBEGIN__
 
 #undef __WKHTMLTOPDF_DLLBEGIN__
@@ -21,5 +26,4 @@
 #undef DLL_LOCAL
 #undef CAPI
 
-#endif //__WKHTMLTOPDF_DLLBEGIN__
-
+#endif /*__WKHTMLTOPDF_DLLBEGIN__*/

+ 30 - 25
src/lib/image.h

@@ -1,22 +1,23 @@
-// -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
-// vi:set ts=4 sts=4 sw=4 noet :
-//
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+ * vi:set ts=4 sts=4 sw=4 noet :
+ *
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
 
 #ifndef __IMAGE_H__
 #define __IMAGE_H__
@@ -32,6 +33,10 @@ typedef void (*wkhtmltoimage_str_callback)(wkhtmltoimage_converter * converter,
 typedef void (*wkhtmltoimage_int_callback)(wkhtmltoimage_converter * converter, const int val);
 typedef void (*wkhtmltoimage_void_callback)(wkhtmltoimage_converter * converter);
 
+CAPI int wkhtmltoimage_init(int useGraphics);
+CAPI int wkhtmltoimage_deinit();
+CAPI int wkhtmltoimage_extended_qt();
+
 CAPI wkhtmltoimage_global_settings * wkhtmltoinage_create_global_settings();
 
 CAPI int wkhtmltoimage_set_global_option(wkhtmltoimage_global_settings * settings, const char * name, const char * value);
@@ -40,11 +45,11 @@ CAPI int wkhtmltoimage_get_global_option(wkhtmltoimage_global_settings * setting
 CAPI wkhtmltoimage_converter * wkhtmltoimage_create_converter(wkhtmltoimage_global_settings * settings);
 CAPI void wkhtmltoimage_destroy_converter(wkhtmltoimage_converter * converter);
 
-CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb);
-CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb);
-CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback * cb);
-CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback * cb);
-CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback * cb);
+CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
+CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb);
+CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback cb);
+CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
+CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb);
 CAPI void wkhtmltoimage_begin_convertion(wkhtmltoimage_converter * converter);
 CAPI int wkhtmltoimage_convert(wkhtmltoimage_converter * converter);
 CAPI void wkhtmltoimage_cancel(wkhtmltoimage_converter * converter);
@@ -56,4 +61,4 @@ CAPI const char * wkhtmltoimage_progress_string(wkhtmltoimage_converter * conver
 CAPI int wkhtmltoimage_http_error_code(wkhtmltoimage_converter * converter);
 
 #include <wkhtmltox/dllend.inc>
-#endif //__IMAGE_H__
+#endif /*__IMAGE_H__*/

+ 31 - 11
src/lib/image_c_bindings.cc

@@ -19,38 +19,58 @@
 // along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "image_c_bindings_p.hh"
+#include "pdf.h"
 
 #include "dllbegin.inc"
 using namespace wkhtmltopdf;
 
 void MyImageConverter::warning(const QString & message) {
-	if (warning_cb) (*warning_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), message.toUtf8().constData());
+	if (warning_cb) (warning_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), message.toUtf8().constData());
 }
 
 void MyImageConverter::error(const QString & message) {
-	if (error_cb) (*error_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), message.toUtf8().constData());
+	if (error_cb) (error_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), message.toUtf8().constData());
 }
 
 void MyImageConverter::phaseChanged() {
-	if (phase_changed) (*phase_changed)(reinterpret_cast<wkhtmltoimage_converter*>(this));
+	if (phase_changed) (phase_changed)(reinterpret_cast<wkhtmltoimage_converter*>(this));
 }
 
 void MyImageConverter::progressChanged(int progress) {
-	if (progress_changed) (*progress_changed)(reinterpret_cast<wkhtmltoimage_converter*>(this), progress);
+	if (progress_changed) (progress_changed)(reinterpret_cast<wkhtmltoimage_converter*>(this), progress);
 }
 
 void MyImageConverter::finished(bool ok) {
-	if (finished_cb) (*finished_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), ok);
+	if (finished_cb) (finished_cb)(reinterpret_cast<wkhtmltoimage_converter*>(this), ok);
 }
 
 MyImageConverter::MyImageConverter(settings::ImageGlobal * gs):
 	warning_cb(0), error_cb(0), phase_changed(0), progress_changed(0), finished_cb(0),
-	converter(*gs), globalSettings(gs) {}
+	converter(*gs), globalSettings(gs) {
+
+    connect(&converter, SIGNAL(warning(const QString &)), this, SLOT(warning(const QString &)));
+	connect(&converter, SIGNAL(error(const QString &)), this, SLOT(error(const QString &)));
+	connect(&converter, SIGNAL(phaseChanged()), this, SLOT(phaseChanged()));
+	connect(&converter, SIGNAL(progressChanged(int)), this, SLOT(progressChanged(int)));
+	connect(&converter, SIGNAL(finished(bool)), this, SLOT(finished(bool)));
+}
 
 MyImageConverter::~MyImageConverter() {
 	delete globalSettings;
 }
 
+CAPI int wkhtmltoimage_init(int useGraphics) {
+	return wkhtmltopdf_init(useGraphics);
+}
+
+CAPI int wkhtmltoimage_deinit() {
+	return wkhtmltopdf_deinit();
+}
+
+CAPI int wkhtmltoimage_extended_qt() {
+	return wkhtmltopdf_extended_qt();
+}
+
 CAPI wkhtmltoimage_global_settings * wkhtmltoimage_create_global_settings() {
 	return reinterpret_cast<wkhtmltoimage_global_settings *>(new settings::ImageGlobal());
 }
@@ -75,23 +95,23 @@ CAPI void wkhtmltoimage_destroy_converter(wkhtmltoimage_converter * converter) {
 	delete reinterpret_cast<MyImageConverter *>(converter);
 }
 
-CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb) {
+CAPI void wkhtmltoimage_set_warning_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb) {
 	reinterpret_cast<MyImageConverter *>(converter)->warning_cb = cb;
 }
 
-CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback * cb) {
+CAPI void wkhtmltoimage_set_error_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_str_callback cb) {
 	reinterpret_cast<MyImageConverter *>(converter)->error_cb = cb;
 }
 
-CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback * cb) {
+CAPI void wkhtmltoimage_set_phase_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_void_callback cb) {
 	reinterpret_cast<MyImageConverter *>(converter)->phase_changed = cb;
 }
 
-CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback * cb) {
+CAPI void wkhtmltoimage_set_progress_changed_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb) {
 	reinterpret_cast<MyImageConverter *>(converter)->progress_changed = cb;
 }
 
-CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback * cb) {
+CAPI void wkhtmltoimage_set_finished_callback(wkhtmltoimage_converter * converter, wkhtmltoimage_int_callback cb) {
 	reinterpret_cast<MyImageConverter *>(converter)->finished_cb = cb;
 }
 

+ 5 - 5
src/lib/image_c_bindings_p.hh

@@ -29,11 +29,11 @@
 class DLL_LOCAL MyImageConverter: public QObject {
     Q_OBJECT
 public:
-	wkhtmltoimage_str_callback * warning_cb;
-	wkhtmltoimage_str_callback * error_cb;
-	wkhtmltoimage_void_callback * phase_changed;
-	wkhtmltoimage_int_callback * progress_changed;
-	wkhtmltoimage_int_callback * finished_cb;
+	wkhtmltoimage_str_callback warning_cb;
+	wkhtmltoimage_str_callback error_cb;
+	wkhtmltoimage_void_callback phase_changed;
+	wkhtmltoimage_int_callback progress_changed;
+	wkhtmltoimage_int_callback finished_cb;
 
 	wkhtmltopdf::ImageConverter converter;
 

+ 30 - 25
src/lib/pdf.h

@@ -1,22 +1,23 @@
-// -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
-// vi:set ts=4 sts=4 sw=4 noet :
-//
-// Copyright 2010 wkhtmltopdf authors
-//
-// This file is part of wkhtmltopdf.
-//
-// wkhtmltopdf is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// wkhtmltopdf is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with wkhtmltopdf.  If not, see <http://www.gnu.org/licenses/>.
+/* -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
+ * vi:set ts=4 sts=4 sw=4 noet :
+ *
+ * Copyright 2010 wkhtmltopdf authors
+ *
+ * This file is part of wkhtmltopdf.
+ *
+ * wkhtmltopdf is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wkhtmltopdf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wkhtmltopdf.  If not, see <http: *www.gnu.org/licenses/>.
+ */
 
 #ifndef __PDF_H__
 #define __PDF_H__
@@ -35,6 +36,10 @@ typedef void (*wkhtmltopdf_str_callback)(wkhtmltopdf_converter * converter, cons
 typedef void (*wkhtmltopdf_int_callback)(wkhtmltopdf_converter * converter, const int val);
 typedef void (*wkhtmltopdf_void_callback)(wkhtmltopdf_converter * converter);
 
+CAPI int wkhtmltopdf_init(int useGraphics);
+CAPI int wkhtmltopdf_deinit();
+CAPI int wkhtmltopdf_extended_qt();
+
 CAPI wkhtmltopdf_global_settings * wkhtmltopdf_create_global_settings();
 CAPI wkhtmltopdf_object_settings * wkhtmltopdf_create_object_settings();
 
@@ -47,11 +52,11 @@ CAPI int wkhtmltopdf_get_object_setting(wkhtmltopdf_object_settings * settings,
 CAPI wkhtmltopdf_converter * wkhtmltopdf_create_converter(wkhtmltopdf_global_settings * settings);
 CAPI void wkhtmltopdf_destroy_converter(wkhtmltopdf_converter * converter);
 
-CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb);
-CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb);
-CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback * cb);
-CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback * cb);
-CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback * cb);
+CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
+CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb);
+CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback cb);
+CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
+CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb);
 CAPI void wkhtmltopdf_begin_convertion(wkhtmltopdf_converter * converter);
 CAPI int wkhtmltopdf_convert(wkhtmltopdf_converter * converter);
 CAPI void wkhtmltopdf_cancel(wkhtmltopdf_converter * converter);
@@ -65,4 +70,4 @@ CAPI const char * wkhtmltopdf_progress_string(wkhtmltopdf_converter * converter)
 CAPI int wkhtmltopdf_http_error_code(wkhtmltopdf_converter * converter);
 
 #include <wkhtmltox/dllend.inc>
-#endif //__PDF_H__
+#endif /*__PDF_H__*/

+ 61 - 15
src/lib/pdf_c_bindings.cc

@@ -20,37 +20,48 @@
 
 /**
  * \file pdf.h
- * \brief Provides C bindings for pdf convertion 
+ * \brief Provides C bindings for pdf convertion
  */
-
 #include "pdf_c_bindings_p.hh"
+#include "utilities.hh"
+#include <QApplication>
+#include <QWebFrame>
 
 #include "dllbegin.inc"
 using namespace wkhtmltopdf;
 
+QApplication * a = 0;
+
 void MyPdfConverter::warning(const QString & message) {
-	if (warning_cb) (*warning_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), message.toUtf8().constData());
+	if (warning_cb) (warning_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), message.toUtf8().constData());
 }
 
 void MyPdfConverter::error(const QString & message) {
-	if (error_cb) (*error_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), message.toUtf8().constData());
+	if (error_cb) (error_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), message.toUtf8().constData());
 }
 
 void MyPdfConverter::phaseChanged() {
-	if (phase_changed) (*phase_changed)(reinterpret_cast<wkhtmltopdf_converter*>(this));
+	if (phase_changed) (phase_changed)(reinterpret_cast<wkhtmltopdf_converter*>(this));
 }
 
 void MyPdfConverter::progressChanged(int progress) {
-	if (progress_changed) (*progress_changed)(reinterpret_cast<wkhtmltopdf_converter*>(this), progress);
+	if (progress_changed) (progress_changed)(reinterpret_cast<wkhtmltopdf_converter*>(this), progress);
 }
 
 void MyPdfConverter::finished(bool ok) {
-	if (finished_cb) (*finished_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), ok);
+	if (finished_cb) (finished_cb)(reinterpret_cast<wkhtmltopdf_converter*>(this), ok);
 }
 
 MyPdfConverter::MyPdfConverter(settings::PdfGlobal * gs):
 	warning_cb(0), error_cb(0), phase_changed(0), progress_changed(0), finished_cb(0),
-	converter(*gs), globalSettings(gs) {}
+	converter(*gs), globalSettings(gs) {
+
+    connect(&converter, SIGNAL(warning(const QString &)), this, SLOT(warning(const QString &)));
+	connect(&converter, SIGNAL(error(const QString &)), this, SLOT(error(const QString &)));
+	connect(&converter, SIGNAL(phaseChanged()), this, SLOT(phaseChanged()));
+	connect(&converter, SIGNAL(progressChanged(int)), this, SLOT(progressChanged(int)));
+	connect(&converter, SIGNAL(finished(bool)), this, SLOT(finished(bool)));
+}
 
 MyPdfConverter::~MyPdfConverter() {
 	delete globalSettings;
@@ -59,9 +70,43 @@ MyPdfConverter::~MyPdfConverter() {
 	objectSettings.clear();
 }
 
+CAPI int wkhtmltopdf_extended_qt() {
+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__
+	return 1;
+#else
+	return 0;
+#endif
+}
+
+
+CAPI int wkhtmltopdf_init(int ug) {
+	if (qApp == 0) {
+		char * arg[] = {"wkhtmltox", 0};
+		int aa;
+
+		bool use_graphics=true;
+#if defined(Q_WS_X11) || defined(Q_WS_MACX)
+#ifdef __EXTENSIVE_WKHTMLTOPDF_QT_HACK__
+		use_graphics=ug;
+		if (!use_graphics) QApplication::setGraphicsSystem("raster");
+#endif
+#endif
+		a = new QApplication(aa,arg,use_graphics);
+		MyLooksStyle * style = new MyLooksStyle();
+		a->setStyle(style);
+	}
+	return 1;
+}
+
+CAPI int wkhtmltopdf_deinit() {
+	if (a != 0) delete a;
+	return 1;
+}
+
+
 /**
  * \brief Create a new global settings object for pdf convertion
- * 
+ *
  * Create a new global settings object for pdf convertion, settings can be altered with
  * \ref wkhtmltopdf_set_global_setting, and inspected with \ref wkhtmltopdf_get_global_setting.
  * Once the decired settings have been set a converter object can be created using \reg wkhtmltopdf_create_converter.
@@ -90,7 +135,7 @@ CAPI int wkhtmltopdf_set_global_setting(wkhtmltopdf_global_settings * settings,
  * \brief Retrive a setting in a global settings object
  *
  * \sa wkhtmltopdf_create_global_settings, wkhtmltopdf_set_global_setting
- * 
+ *
  * \param settings The settings object to inspect
  * \param name The name of the setting to read
  * \param value A buffer of length at least \a vs, where the value is storred.
@@ -120,6 +165,7 @@ CAPI int wkhtmltopdf_get_object_setting(wkhtmltopdf_object_settings * settings,
 }
 
 CAPI wkhtmltopdf_converter * wkhtmltopdf_create_converter(wkhtmltopdf_global_settings * settings) {
+
 	return reinterpret_cast<wkhtmltopdf_converter *>(
 		new MyPdfConverter(reinterpret_cast<settings::PdfGlobal *>(settings)));
 }
@@ -128,23 +174,23 @@ CAPI void wkhtmltopdf_destroy_converter(wkhtmltopdf_converter * converter) {
 	delete reinterpret_cast<MyPdfConverter *>(converter);
 }
 
-CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb) {
+CAPI void wkhtmltopdf_set_warning_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb) {
 	reinterpret_cast<MyPdfConverter *>(converter)->warning_cb = cb;
 }
 
-CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback * cb) {
+CAPI void wkhtmltopdf_set_error_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_str_callback cb) {
 	reinterpret_cast<MyPdfConverter *>(converter)->error_cb = cb;
 }
 
-CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback * cb) {
+CAPI void wkhtmltopdf_set_phase_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_void_callback cb) {
 	reinterpret_cast<MyPdfConverter *>(converter)->phase_changed = cb;
 }
 
-CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback * cb) {
+CAPI void wkhtmltopdf_set_progress_changed_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb) {
 	reinterpret_cast<MyPdfConverter *>(converter)->progress_changed = cb;
 }
 
-CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback * cb) {
+CAPI void wkhtmltopdf_set_finished_callback(wkhtmltopdf_converter * converter, wkhtmltopdf_int_callback cb) {
 	reinterpret_cast<MyPdfConverter *>(converter)->finished_cb = cb;
 }
 

+ 5 - 5
src/lib/pdf_c_bindings_p.hh

@@ -30,11 +30,11 @@
 class DLL_LOCAL MyPdfConverter: public QObject {
     Q_OBJECT
 public:
-	wkhtmltopdf_str_callback * warning_cb;
-	wkhtmltopdf_str_callback * error_cb;
-	wkhtmltopdf_void_callback * phase_changed;
-	wkhtmltopdf_int_callback * progress_changed;
-	wkhtmltopdf_int_callback * finished_cb;
+	wkhtmltopdf_str_callback warning_cb;
+	wkhtmltopdf_str_callback error_cb;
+	wkhtmltopdf_void_callback phase_changed;
+	wkhtmltopdf_int_callback progress_changed;
+	wkhtmltopdf_int_callback finished_cb;
 
 	wkhtmltopdf::PdfConverter converter;