page_print 0.1.8-x86_64-linux → 0.1.9-x86_64-linux

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: 3200a2bdff1d6d8d710fadaffe11918ab3a85304bd41cdbaac12981ecb85186e
4
- data.tar.gz: cecc18dd91b32bd56e8246f70c9653a59f0b1c327a2036afcc25ce63c9bcab04
3
+ metadata.gz: ad5333358befafb0066b49716228e8ae374d069253ef0e05a67dc0c21b86f2d6
4
+ data.tar.gz: dd8b0aef43b70ad871454c4fc69710310b2f5c8dd80489a7cbc0b43086030c20
5
5
  SHA512:
6
- metadata.gz: 4e17f9312def12e19680048d69af45c8d28dc9f685c5b7254e6baf1382258396aa7eda562639e96e03b19fc04856d600c67126edb28a5701b7d3d029af2e8539
7
- data.tar.gz: 325dbb540c591f9e018049481dda01f37989d517165efb4db186a5bf59f3dc2155812a512604d42f572b7ac90a0585a02d59c4d5c684b7253d5c4a12dab42a17
6
+ metadata.gz: 6e5602e35a26a8394c07533d3195a8a4740f8ac1cd114a95d9b8b51eb5772656d8d7bc8b93de5dde61ebbade67796d53b7ffea7991ffd2690d27e417f77e29ef
7
+ data.tar.gz: 7a13cf451ac681277bf9193e26d9ac94f8b5d4b20be76239438c6cb076df8cb3d47791af37a0592a6200e2f04c440b4723df0f3681e2474b1ce97e52c7d3a783
data/README.md CHANGED
@@ -33,7 +33,7 @@ Render a PDF from a controller:
33
33
  class PrintsController < ApplicationController
34
34
  def pdf
35
35
  html = render_to_string(template: "prints/pdf", formats: [:html], layout: "pdf")
36
- pdf = PagePrint.html_to_pdf_string(
36
+ pdf = PagePrint.render(
37
37
  html,
38
38
  page_size: :a4,
39
39
  margins: :normal,
@@ -58,7 +58,7 @@ During controller actions, PagePrint defaults `base_url` to `request.base_url`.
58
58
  You can still override `base_url` explicitly:
59
59
 
60
60
  ```ruby
61
- pdf = PagePrint.html_to_pdf_string(html, base_url: "https://example.com")
61
+ pdf = PagePrint.render(html, base_url: "https://example.com")
62
62
  ```
63
63
 
64
64
  Override the fetcher only when needed:
@@ -87,19 +87,19 @@ HTML
87
87
 
88
88
  output_path = File.join(Dir.tmpdir, "page_print-output.pdf")
89
89
 
90
- PagePrint.html_to_pdf(html, output_path, base_url: "https://example.com")
90
+ PagePrint.render_to_file(html, output_path, base_url: "https://example.com")
91
91
  ```
92
92
 
93
93
  To get the generated PDF as a binary string instead of writing directly to a file:
94
94
 
95
95
  ```ruby
96
- pdf = PagePrint.html_to_pdf_string(html, base_url: "https://example.com")
96
+ pdf = PagePrint.render(html, base_url: "https://example.com")
97
97
  ```
98
98
 
99
99
  Use custom page dimensions and margins when a preset is not enough:
100
100
 
101
101
  ```ruby
102
- pdf = PagePrint.html_to_pdf_string(
102
+ pdf = PagePrint.render(
103
103
  html,
104
104
  page_size: { width: 100, height: 150, unit: :mm },
105
105
  margins: { top: 5, right: 6, bottom: 7, left: 8, unit: :mm }
@@ -181,7 +181,7 @@ Native gems bundle PlutoBook and required non-system shared libraries. Optional
181
181
 
182
182
  ## Notes
183
183
 
184
- - The extension supports writing to a file path with `html_to_pdf` or returning PDF bytes with `html_to_pdf_string`.
184
+ - The extension supports writing to a file path with `render_to_file` or returning PDF bytes with `render`.
185
185
  - JavaScript execution is intentionally unsupported.
186
186
  - Native gems disable PlutoBook's optional curl, TurboJPEG, and WebP features.
187
187
 
@@ -213,13 +213,13 @@ require "tmpdir"
213
213
 
214
214
  output_path = File.join(Dir.tmpdir, "page_print-output.pdf")
215
215
 
216
- PagePrint.html_to_pdf("<html><body><h1>Hello</h1></body></html>", output_path, page_size: :letter, margins: :narrow, media: :screen)
216
+ PagePrint.render_to_file("<html><body><h1>Hello</h1></body></html>", output_path, page_size: :letter, margins: :narrow, media: :screen)
217
217
  ```
218
218
 
219
219
  You can also do a quick one-shot smoke test from the shell:
220
220
 
221
221
  ```sh
222
- bundle exec ruby -Ilib -e 'require "tmpdir"; require "page_print"; output_path = File.join(Dir.tmpdir, "page_print-output.pdf"); p PagePrint.html_to_pdf("<html><body><h1>Hello</h1></body></html>", output_path, page_size: :letter, margins: :narrow, media: :screen)'
222
+ bundle exec ruby -Ilib -e 'require "tmpdir"; require "page_print"; output_path = File.join(Dir.tmpdir, "page_print-output.pdf"); p PagePrint.render_to_file("<html><body><h1>Hello</h1></body></html>", output_path, page_size: :letter, margins: :narrow, media: :screen)'
223
223
  ```
224
224
 
225
225
  Or use the development console, which compiles the native extension first and then starts IRB with `PagePrint` loaded:
@@ -277,7 +277,7 @@ Build an Apple Silicon macOS platform gem with a vendored PlutoBook library:
277
277
  bundle exec rake package:darwin_arm64
278
278
  ```
279
279
 
280
- These tasks check out PlutoBook `v0.18.0`, build it into `lib/page_print/vendor/<platform>`, and write a platform gem to `pkg/`. Platform gems compile the Ruby extension during gem install to avoid tying the gem to the build machine's Ruby version.
280
+ These tasks check out PlutoBook `v0.19.0`, build it into `lib/page_print/vendor/<platform>`, and write a platform gem to `pkg/`. Platform gems compile the Ruby extension during gem install to avoid tying the gem to the build machine's Ruby version.
281
281
 
282
282
  Native gems bundle PlutoBook and its non-system shared library dependencies. Optional PlutoBook features for curl, TurboJPEG, and WebP are disabled to keep the bundled dependency set smaller.
283
283
 
@@ -739,7 +739,7 @@ static plutobook_stream_status_t pageprint_write_pdf_string(void *closure, const
739
739
  return PLUTOBOOK_STREAM_STATUS_SUCCESS;
740
740
  }
741
741
 
742
- static VALUE pageprint_html_to_pdf(int argc, VALUE *argv, VALUE self) {
742
+ static VALUE pageprint_render_to_file(int argc, VALUE *argv, VALUE self) {
743
743
  VALUE html;
744
744
  VALUE path;
745
745
  VALUE options;
@@ -799,7 +799,7 @@ static VALUE pageprint_html_to_pdf(int argc, VALUE *argv, VALUE self) {
799
799
  return Qtrue;
800
800
  }
801
801
 
802
- static VALUE pageprint_html_to_pdf_string(int argc, VALUE *argv, VALUE self) {
802
+ static VALUE pageprint_render(int argc, VALUE *argv, VALUE self) {
803
803
  VALUE html;
804
804
  VALUE options;
805
805
  pageprint_pdf_string_output_t output;
@@ -888,6 +888,6 @@ void Init_page_print(void) {
888
888
  id_mm = rb_intern_const("mm");
889
889
  id_px = rb_intern_const("px");
890
890
 
891
- rb_define_singleton_method(mPagePrint, "html_to_pdf", RUBY_METHOD_FUNC(pageprint_html_to_pdf), -1);
892
- rb_define_singleton_method(mPagePrint, "html_to_pdf_string", RUBY_METHOD_FUNC(pageprint_html_to_pdf_string), -1);
891
+ rb_define_singleton_method(mPagePrint, "render_to_file", RUBY_METHOD_FUNC(pageprint_render_to_file), -1);
892
+ rb_define_singleton_method(mPagePrint, "render", RUBY_METHOD_FUNC(pageprint_render), -1);
893
893
  }
@@ -39,7 +39,7 @@ extern "C" {
39
39
  #endif
40
40
 
41
41
  #define PLUTOBOOK_VERSION_MAJOR 0
42
- #define PLUTOBOOK_VERSION_MINOR 18
42
+ #define PLUTOBOOK_VERSION_MINOR 19
43
43
  #define PLUTOBOOK_VERSION_MICRO 0
44
44
 
45
45
  #define PLUTOBOOK_VERSION_ENCODE(major, minor, micro) (((major) * 10000) + ((minor) * 100) + ((micro) * 1))
@@ -680,7 +680,7 @@ PLUTOBOOK_API void plutobook_set_http_max_redirects(int amount);
680
680
  /**
681
681
  * @brief Sets the maximum time allowed for an HTTP request.
682
682
  *
683
- * If not set, the default timeout is 300 seconds.
683
+ * If not set, the default timeout is 30 seconds.
684
684
  *
685
685
  * @param timeout Timeout duration in seconds.
686
686
  */
@@ -316,6 +316,16 @@ public:
316
316
  */
317
317
  static const PageMargins Moderate;
318
318
 
319
+ /**
320
+ * @brief Represents wide page margins.
321
+ *
322
+ * - Top: 72 points (1 inch)
323
+ * - Right: 144 points (2 inches)
324
+ * - Bottom: 72 points (1 inch)
325
+ * - Left: 144 points (2 inches)
326
+ */
327
+ static const PageMargins Wide;
328
+
319
329
  private:
320
330
  float m_top{0};
321
331
  float m_right{0};
@@ -327,6 +337,7 @@ inline const PageMargins PageMargins::None = PLUTOBOOK_PAGE_MARGINS_NONE;
327
337
  inline const PageMargins PageMargins::Normal = PLUTOBOOK_PAGE_MARGINS_NORMAL;
328
338
  inline const PageMargins PageMargins::Narrow = PLUTOBOOK_PAGE_MARGINS_NARROW;
329
339
  inline const PageMargins PageMargins::Moderate = PLUTOBOOK_PAGE_MARGINS_MODERATE;
340
+ inline const PageMargins PageMargins::Wide = PLUTOBOOK_PAGE_MARGINS_WIDE;
330
341
 
331
342
  /**
332
343
  * Defines conversion factors for various units to points (pt) and vice versa.
@@ -587,7 +598,7 @@ public:
587
598
  /**
588
599
  * @brief Sets the maximum time allowed for a request.
589
600
  *
590
- * If not set, the default timeout is 300 seconds.
601
+ * If not set, the default timeout is 30 seconds.
591
602
  *
592
603
  * @param timeout Timeout duration in seconds.
593
604
  */
@@ -612,7 +623,7 @@ private:
612
623
 
613
624
  bool m_followRedirects = true;
614
625
  int m_maxRedirects = 30;
615
- int m_timeout = 300;
626
+ int m_timeout = 30;
616
627
 
617
628
  friend DefaultResourceFetcher* defaultResourceFetcher();
618
629
  };
@@ -4,8 +4,8 @@ libdir=${prefix}/lib
4
4
 
5
5
  Name: PlutoBook
6
6
  Description: Paged HTML rendering library
7
- Version: 0.18.0
8
- Requires.private: harfbuzz, expat >= 2.1.0, icu-uc >= 57.0, icu-i18n >= 57.0, freetype2 >= 9.7.3, fontconfig >= 2.12.5, cairo >= 1.15.10, cairo-pdf >= 1.15.10, cairo-png >= 1.15.10, cairo-ft >= 1.15.10, cairo-fc >= 1.15.10
7
+ Version: 0.19.0
8
+ Requires.private: harfbuzz, expat >= 2.1.0, icu-uc >= 57.0, freetype2 >= 9.7.3, fontconfig >= 2.12.5, cairo >= 1.15.10, cairo-pdf >= 1.15.10, cairo-png >= 1.15.10, cairo-ft >= 1.15.10, cairo-fc >= 1.15.10
9
9
  Libs: -L${libdir} -lplutobook
10
10
  Libs.private: -pthread -lm
11
11
  Cflags: -I${includedir}/plutobook
@@ -6,5 +6,5 @@ libharfbuzz-subset.so libharfbuzz-subset.so.0.61230.0
6
6
  libharfbuzz-subset.so.0 libharfbuzz-subset.so.0.61230.0
7
7
  libharfbuzz.so libharfbuzz.so.0.61230.0
8
8
  libharfbuzz.so.0 libharfbuzz.so.0.61230.0
9
- libplutobook.so libplutobook.so.0.18.0
10
- libplutobook.so.0 libplutobook.so.0.18.0
9
+ libplutobook.so libplutobook.so.0.19.0
10
+ libplutobook.so.0 libplutobook.so.0.19.0
@@ -1,3 +1,3 @@
1
1
  module PagePrint
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Dino Maric
@@ -91,12 +91,11 @@ files:
91
91
  - lib/page_print/vendor/x86_64-linux/lib/libharfbuzz-subset.so.0.61230.0
92
92
  - lib/page_print/vendor/x86_64-linux/lib/libharfbuzz.so.0.61230.0
93
93
  - lib/page_print/vendor/x86_64-linux/lib/libicudata.so.67
94
- - lib/page_print/vendor/x86_64-linux/lib/libicui18n.so.67
95
94
  - lib/page_print/vendor/x86_64-linux/lib/libicuuc.so.67
96
95
  - lib/page_print/vendor/x86_64-linux/lib/libmd.so.0
97
96
  - lib/page_print/vendor/x86_64-linux/lib/libpcre.so.3
98
97
  - lib/page_print/vendor/x86_64-linux/lib/libpixman-1.so.0
99
- - lib/page_print/vendor/x86_64-linux/lib/libplutobook.so.0.18.0
98
+ - lib/page_print/vendor/x86_64-linux/lib/libplutobook.so.0.19.0
100
99
  - lib/page_print/vendor/x86_64-linux/lib/libpng16.so.16
101
100
  - lib/page_print/vendor/x86_64-linux/lib/libuuid.so.1
102
101
  - lib/page_print/vendor/x86_64-linux/lib/libxcb-render.so.0