wicked_pdf_standalone 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -1
- data/lib/wicked_pdf_standalone/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -18,7 +18,22 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Here is example usage, with draper:
|
22
|
+
|
23
|
+
$ output_path = File.join("/tmp", "file.pdf")
|
24
|
+
$ @subject = Model.find(1)
|
25
|
+
$ @pdf_renderer_instance = WkPdfRenderer.new
|
26
|
+
$ @pdf_renderer_instance.to_file(output_path, subject.some_default_pdf_renderer_options) do |renderer|
|
27
|
+
$ renderer.instance_variable_set("@subject", SubjectDecorator.decorate(@subject))
|
28
|
+
$ end
|
29
|
+
|
30
|
+
And if you want to spit out a file, right away:
|
31
|
+
|
32
|
+
$ save_path = Rails.root.join("filename.pdf")
|
33
|
+
$ file = File.open(save_path, 'wb') do |file|
|
34
|
+
$ file << @pdf_renderer_instance.send(:make_pdf)
|
35
|
+
$ end
|
36
|
+
$
|
22
37
|
|
23
38
|
## Contributing
|
24
39
|
|