gtk_webkit_pdf 0.0.2 → 0.0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +20 -22
- data/ext/gtk_webkit_pdf/printer.c +0 -1
- data/ext/gtk_webkit_pdf/webkit.c +1 -1
- data/gtk_webkit_pdf.gemspec +1 -1
- data/lib/gtk_webkit_pdf.rb +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -2,27 +2,25 @@ Creating The PDF from HTML using GTK WEBKIT Tool.
|
|
2
2
|
|
3
3
|
MAIN FEATURE OF GTK_WEBKIT_PDF
|
4
4
|
==============================
|
5
|
-
1 . This is pure ruby extension based pdf creator using gtk webkit api.
|
5
|
+
1 . This is pure ruby extension based pdf creator using gtk webkit api.
|
6
6
|
|
7
7
|
FEATURE ADDED WITH THIS NEW VERSION 0.0.2
|
8
8
|
=========================================
|
9
|
-
1 . Supports for RAILS integration.
|
10
|
-
2 . Create pdf based on the format in the controller with various options.
|
11
|
-
3 . Supports for rake level pdf creation.
|
9
|
+
1 . Supports for RAILS integration.
|
10
|
+
2 . Create pdf based on the format in the controller with various options.
|
11
|
+
3 . Supports for rake level pdf creation.
|
12
12
|
|
13
13
|
EXAMPLE:
|
14
14
|
|
15
|
-
webkit = GTK::Webkit.new(string_data, format, options) #creates the webkit object
|
16
|
-
where "format" =>
|
17
|
-
|
18
|
-
|
15
|
+
webkit = GTK::Webkit.new(string_data, format, options) #creates the webkit object
|
16
|
+
where "format" =>
|
17
|
+
1 . 0(zero) - means you are giving the html string to the first parameter(that is string_data).
|
18
|
+
2 . 1(one) - future usage.
|
19
|
+
3 . 2(two) - means you are giving the URI to the first parameter(that is string_data).
|
19
20
|
|
20
|
-
printer = webkit.gtk_printer #which returns the printer object, using this printer object you get the pdf content like below
|
21
|
-
printer.pdf_content #returns pdf contenht as a string, then you can save this pdf content to a file or you can render using
|
22
|
-
|
23
|
-
#You can also export to a file using the following
|
24
|
-
printer.export(base_url, filename) #base_url => base directory(like /home/mohanraj/)
|
25
|
-
#filename => name of the file, you want to export
|
21
|
+
printer = webkit.gtk_printer #which returns the printer object, using this printer object you get the pdf content like below
|
22
|
+
printer.pdf_content #returns pdf contenht as a string, then you can save this pdf content to a file or you can render using "send_data"(in the case of download). You can also export to a file using the following
|
23
|
+
printer.export(base_url, filename) #base_url => base directory(like /home/mohanraj/), filename => name of the file, you want to export
|
26
24
|
|
27
25
|
CONTROLLER BASED PDF CREATION
|
28
26
|
============================
|
@@ -39,15 +37,15 @@ class UsersController < ApplicationController
|
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
|
-
available options while rendering pdf,
|
43
|
-
:layout => specify the layout, otherwise layout is false
|
44
|
-
:template => template name to render
|
45
|
-
:file => file to use
|
46
|
-
:disposition => default to "inline"
|
47
|
-
:format =>
|
48
|
-
:handler =>
|
40
|
+
available options while rendering pdf,
|
41
|
+
:layout => specify the layout, otherwise layout is false
|
42
|
+
:template => template name to render
|
43
|
+
:file => file to use
|
44
|
+
:disposition => default to "inline"
|
45
|
+
:format =>
|
46
|
+
:handler =>
|
49
47
|
|
50
|
-
NOTE: you have to create the view file for pdf like "index.pdf.erb" in the case of pdf render
|
48
|
+
NOTE: you have to create the view file for pdf like "index.pdf.erb" in the case of pdf render
|
51
49
|
|
52
50
|
MIDDLEWARE SUPPORT
|
53
51
|
==================
|
@@ -14,7 +14,6 @@ static VALUE printer_allocate(VALUE klass) {
|
|
14
14
|
static VALUE c_webkit_webframe_to_pdf(VALUE self, VALUE source) {
|
15
15
|
VALUE temp_path;
|
16
16
|
WEBKIT_PRINTER_PTR(self, source);
|
17
|
-
gtk_init(NULL, NULL);
|
18
17
|
|
19
18
|
//PRINTER CONFIGURATIONS
|
20
19
|
set_printer_configurations(self);
|
data/ext/gtk_webkit_pdf/webkit.c
CHANGED
@@ -15,7 +15,6 @@ static VALUE webkit_allocate(VALUE klass) {
|
|
15
15
|
static VALUE c_generate_pdf(VALUE self) {
|
16
16
|
VALUE source, content;
|
17
17
|
WEBKIT_PTR(self);
|
18
|
-
gtk_init(NULL, NULL);
|
19
18
|
|
20
19
|
webkit -> webkit_webview = WEBKIT_WEB_VIEW(webkit_web_view_new());
|
21
20
|
source = rb_iv_get(self, "@source");
|
@@ -38,6 +37,7 @@ static VALUE c_generate_pdf(VALUE self) {
|
|
38
37
|
}
|
39
38
|
|
40
39
|
void Init_webkit(void) {
|
40
|
+
gtk_init(NULL, NULL);
|
41
41
|
cGTK = rb_define_module("GTK");
|
42
42
|
cWebkit = rb_define_class_under(cGTK, "Webkit", rb_cObject);
|
43
43
|
|
data/gtk_webkit_pdf.gemspec
CHANGED
data/lib/gtk_webkit_pdf.rb
CHANGED