palapala_pdf 0.1.3 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95d833844d730f058d59abd1eaaee467dde4fa8b4f3b9d01dd441646675c585b
4
- data.tar.gz: b30cd15b438c71801ec9f8b0c0c61ae2aa47543cc59bd36975dd52b9974af98a
3
+ metadata.gz: 1936c1468578b9ee403747b56d61cd1bb85bba58170f5fb5353a991ee31b9193
4
+ data.tar.gz: 44d9a9b48a799bb71051fbd5956fd50337d1593e82e4e3b79f4d3a191afa7fa5
5
5
  SHA512:
6
- metadata.gz: f34c4baea12a5f2577da4bc629319470f7f46dddd3b1ad05b142d0abba6598caefe2128d93035a6d58d65e9357cec32e461a5650fae99606eeae749ded843621
7
- data.tar.gz: ac072fb99db23b9b3d7895f4cbd8fed028dd6b5555d1ea1b8ebbc341e4845f901f75a07d4df621691340d754b2d624fc5638d6e2725922fd248d7879441a86a3
6
+ metadata.gz: be6bc220cecd817955205649eea3a9e47d74f08937f832b08ce712e64dd42fe799f3954482896f72761bbbc7ca01bf81a1c1ec19d2939b0c0d339862dbf14fd2
7
+ data.tar.gz: 327b98089480ec4afb952bbd776738702b4183f26be75865816873658243763dd9a9d1541c9b3be3ceeda5b6f36d1bb753f3c180ef3e95c6d7e6df40a9d837b7
data/README.md CHANGED
@@ -8,7 +8,7 @@ This is how easy and powerfull PDF generation can be in Ruby:
8
8
 
9
9
  ```ruby
10
10
  require "palapala"
11
- Palapala::PDF.new("<h1>Hello, world! #{Time.now}</h1>").save('hello.pdf')
11
+ Palapala::Pdf.new("<h1>Hello, world! #{Time.now}</h1>").save('hello.pdf')
12
12
  ```
13
13
 
14
14
  And this while having the most modern HTML/CSS/JS availlable to you: flex, grid, canvas, you name it.
@@ -76,14 +76,14 @@ in IRB, load palapala and create a PDF from an HTML snippet:
76
76
 
77
77
  ```ruby
78
78
  require "palapala"
79
- Palapala::PDF.new("<h1>Hello, world! #{Time.now}</h1>").save('hello.pdf')
79
+ Palapala::Pdf.new("<h1>Hello, world! #{Time.now}</h1>").save('hello.pdf')
80
80
  ```
81
81
 
82
- Instantiate a new Palapala::PDF object with your HTML content and generate the PDF binary data.
82
+ Instantiate a new Palapala::Pdf object with your HTML content and generate the PDF binary data.
83
83
 
84
84
  ```ruby
85
85
  require "palapala"
86
- binary_data = Palapala::PDF.new("<h1>Hello, world! #{Time.now}</h1>").binary_data
86
+ binary_data = Palapala::Pdf.new("<h1>Hello, world! #{Time.now}</h1>").binary_data
87
87
  ```
88
88
 
89
89
  ## Paged CSS
@@ -97,7 +97,7 @@ When using Chromium-based rendering engines, headers and footers are not control
97
97
  With palapala PDF headers and footers are defined using `header_html` and `footer_html` options. These allow you to insert HTML content directly into the header or footer areas.
98
98
 
99
99
  ```ruby
100
- Palapala::PDF.new(
100
+ Palapala::Pdf.new(
101
101
  "<p>Hello world</>",
102
102
  header_html: '<div style="text-align: center;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
103
103
  footer_html: '<div style="text-align: center;">Generated with Palapala PDF</div>',
@@ -198,7 +198,7 @@ Here's an example of how to use `render_to_string` to render a view template to
198
198
  ```ruby
199
199
  def download_pdf
200
200
  html_string = render_to_string(template: "example/template", layout: "print", locals: { } )
201
- pdf_data = Palapala::PDF.new(html_string).binary_data
201
+ pdf_data = Palapala::Pdf.new(html_string).binary_data
202
202
  send_data pdf_data, filename: "document.pdf", type: "application/pdf"
203
203
  end
204
204
  ```
data/lib/palapala/pdf.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Palapala
4
4
  # Page class to generate PDF from HTML content using Chrome in headless mode in a thread-safe way
5
5
  # @param page_ranges Empty string means all pages, e.g., "1-3, 5, 7-9"
6
- class PDF
6
+ class Pdf
7
7
  def initialize(content = nil,
8
8
  header_html: nil,
9
9
  footer_html: nil,
@@ -37,13 +37,14 @@ module Palapala
37
37
  end
38
38
 
39
39
  def pdf(**opts)
40
+ puts "Rendering PDF with options: #{opts}" if Palapala.debug
40
41
  renderer.html_to_pdf(@content, params: opts_with_defaults.merge(opts))
41
42
  end
42
43
 
43
44
  def opts_with_defaults
44
45
  opts = { scale: @scale,
45
46
  printBackground: true,
46
- dispayHeaderFooter: true,
47
+ displayHeaderFooter: true,
47
48
  encoding: :binary,
48
49
  preferCSSPageSize: @prefer_css_page_size }
49
50
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Palapala
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.5'
5
5
  end
data/lib/palapala.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'palapala/version'
3
4
  require_relative 'palapala/pdf'
4
5
  require_relative 'palapala/web_socket_client'
5
6
  require_relative 'palapala/renderer'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: palapala_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koen Handekyn