gkhtmltopdf 1.1.0 → 1.2.0

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: 693828b2a9f004f9038b744c5d4a527a46f27ca55ad7c3d4638478aa2a747ade
4
- data.tar.gz: 418727b131d4305641bcb66df639c961aabc73de334fd599b06d772f2b0557ba
3
+ metadata.gz: 9b1e75b29bc038ca05956a13cecbd811f766f5ce5047b044348f707e18f5fdaf
4
+ data.tar.gz: 6f4880a82c257459133d3d63cb9eca5b6b538095ee9278b5846d965b53edda95
5
5
  SHA512:
6
- metadata.gz: 8776f073004b0e5dba496316e4c95e18121784be2430b12f679dc900cfee41e7002befda8fe022f30739e8bdf33c76ce7c51cd625ed5e5095cc95f4eb60b4d3f
7
- data.tar.gz: 3df53840690e009d5c39a18710867505eff22e0bbb0d6711dfc6f8cc44a73442c02f1d6f5b5c1c3ac9f5c5c327f61d377bbab9a73dafea0124ff4a20e378426b
6
+ metadata.gz: ec2c49f78a33d7be7257e09bc66508d14b65880ab88b48d636580de5052abbd31a34f2544d0c7c9acb1491ddda8fe74f09ff5d22c061ea465261170ca85388ae
7
+ data.tar.gz: 8e518a69a0183db0f3a4545d9fc20e8654cc189df79af68b1297b74b19f96a76ad74288fc12a107aaaab038903e678ab4102ea25983f2ae38e863d11c75907d8
data/CHANGELOG.md CHANGED
@@ -2,11 +2,24 @@
2
2
 
3
3
  All noteworthy changes to this project will be documented in this file.
4
4
 
5
+ ## 1.2.0 / 2026-07-31
6
+
7
+ - Added `pdf_binary` methods.
8
+ - PDFバイナリ取得メソッドの追加
9
+
10
+ ## 1.1.1 / 2026-06-29
11
+
12
+ - Added STDOUT/STDERR for geckodriver.
13
+ - GeckodriverのSTDOUT/STDERR追加
14
+
5
15
  ## 1.1.0 / 2026-06-29
6
16
 
7
- - UA設定機能の追加
8
- - mktmpdirの明示的な削除
9
- - ubuntuでの動かし方とか修正
17
+ - Added User-Agent setting.
18
+ - UA設定機能の追加
19
+ - Explicit deleted of `mktmpdir`.
20
+ - `mktmpdir` の明示的な削除
21
+ - Howto and docs updated.
22
+ - ubuntuでの動かし方とか修正
10
23
 
11
24
  ## 1.0.0 / 2026-03-19
12
25
 
data/README.md CHANGED
@@ -16,33 +16,19 @@ This gem converts HTML to PDF using Firefox's Geckodriver.
16
16
 
17
17
  ### 1. Install
18
18
 
19
- 1. [Firefox](https://www.firefox.com)
20
- - Ubuntu
21
- > The snap does not work correctly, so please install it from the [official source](https://support.mozilla.org/en-US/kb/install-firefox-linux).
22
- ```bash
23
- $ wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
24
- $ echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null
25
- $ tee /etc/apt/preferences.d/mozilla > /dev/null << EOF
26
- Package: *
27
- Pin: origin packages.mozilla.org
28
- Pin-Priority: 1000
29
- EOF
30
- $ apt install -y firefox
31
- $ apt install -y fonts-noto # recommended
32
- ```
33
- - Debian
34
- ```bash
35
- $ apt install -y firefox-esr
36
- $ apt install -y fonts-noto # recommended
37
- ```
38
-
39
- 2. [geckodriver](https://github.com/mozilla/geckodriver)
40
- - Linux (Ubuntu / Debian)
41
- ```bash
42
- $ wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O /tmp/geckodriver.tar.gz
43
- $ tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin
44
- ```
19
+ > The following is an example of the setup on Debian 13.
20
+ > For other operating systems (Ubuntu / Amazon Linux), please see [here](/docs/SupportList.md).
45
21
 
22
+ 1. [Firefox](https://www.firefox.com)
23
+ ```bash
24
+ $ apt install -y firefox-esr
25
+ $ apt install -y fonts-noto # recommended
26
+ ```
27
+ 2. [geckodriver](https://github.com/mozilla/geckodriver)
28
+ ```bash
29
+ $ wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O /tmp/geckodriver.tar.gz
30
+ $ tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin
31
+ ```
46
32
  3. gem install
47
33
  - bundler
48
34
  ```bash
@@ -82,10 +68,18 @@ Gkhtmltopdf.open do |gkh2p|
82
68
  gkh2p.save_pdf('file:///foo/bar/test.html', 'local.pdf')
83
69
  gkh2p.save_pdf('https://f6a.net/oss/', 'with_bg.pdf', print_options: {background: true})
84
70
  end
85
- # set custom user-agent
71
+ # After version 1.1.0: set custom user-agent
86
72
  Gkhtmltopdf.open(user_agent: 'YOUR USER AGENT') do |gkh2p|
87
73
  gkh2p.save_pdf('https://f6a.net/oss/', 'ua.pdf')
88
74
  end
75
+ # After version 1.2.0: get PDF binary
76
+ Gkhtmltopdf.open do |gkh2p|
77
+ pdf_obj = gkh2p.pdf_binary('https://f6a.net/oss/', print_options: {background: true})
78
+ # for example, If the PDF size between 16KB and 1MB, write binary to a file.
79
+ max = 1 * 1000 * 1000
80
+ min = 16 * 1000
81
+ File.binwrite('binary.pdf', pdf_obj) if pdf_obj.bytesize.between?(min, max)
82
+ end
89
83
  ```
90
84
 
91
85
  #### Shell
data/TODO.md CHANGED
@@ -22,14 +22,18 @@
22
22
  - [x] UA設定機能の追加
23
23
  - [x] mktmpdirの明示的な削除
24
24
 
25
- ## つぎ v1.2.0
25
+ ## 完了 v1.1.1
26
26
 
27
- - [ ] 設定のStruct化?(default切り出し)
28
- - [ ] pdfをsaveせずバイナリを直接返却するメソッドの追加
29
- - [ ] 肥大化したconvert.rbの分割( `Gkhtmltopdf::PDF` とかつくるか)
27
+ - [x] GeckodriverのSTDOUT/STDERR追加
28
+
29
+ ## 完了 v1.2.0
30
+
31
+ - [x] pdfをsaveせずバイナリを直接返却するメソッドの追加
30
32
 
31
33
  ## 検討中
32
34
 
35
+ - [ ] 設定のStruct化?(default切り出し)
36
+ - [ ] 肥大化したconvert.rbの分割( `Gkhtmltopdf::PDF` とかつくるか)
33
37
  - [ ] ポート範囲設定?
34
38
  - [ ] YARD追加
35
39
  - [ ] FireFox timeout
@@ -0,0 +1,21 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ FROM amazonlinux:2023
3
+ RUN yum check-update
4
+ RUN yum install -y wget tar git gzip ruby3.2 ruby3.2-devel libyaml-devel
5
+ RUN yum groupinstall -y "Development Tools"
6
+
7
+ # Install Noto Fonts
8
+ RUN yum install -y google-noto-cjk-fonts
9
+ RUN yum install -y google-noto-emoji-fonts
10
+
11
+ # Install Firefox
12
+ RUN yum install -y firefox
13
+
14
+ # Install Geckodriver
15
+ RUN wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O geckodriver.tar.gz
16
+ RUN tar -xzf geckodriver.tar.gz -C /usr/local/bin
17
+
18
+ COPY . /app
19
+ WORKDIR /app
20
+ RUN bundle install
21
+ CMD ["bundle", "exec", "rspec"]
@@ -1,4 +1,3 @@
1
- # escape=\
2
1
  # syntax=docker/dockerfile:1.7
3
2
  FROM ruby:3.2-slim
4
3
 
@@ -0,0 +1,20 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ FROM ruby:3.4-slim
3
+
4
+ RUN apt-get update
5
+ RUN apt-get install -y git wget xz-utils build-essential libyaml-dev
6
+
7
+ # Install Noto Fonts
8
+ RUN apt-get install -y fonts-noto
9
+
10
+ # Install Firefox
11
+ RUN apt-get install -y firefox-esr
12
+
13
+ # Install Geckodriver
14
+ RUN wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O geckodriver.tar.gz
15
+ RUN tar -xzf geckodriver.tar.gz -C /usr/local/bin
16
+
17
+ COPY . /app
18
+ WORKDIR /app
19
+ RUN bundle install
20
+ CMD ["bundle", "exec", "rspec"]
@@ -0,0 +1,20 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ FROM ruby:4.0-slim
3
+
4
+ RUN apt-get update
5
+ RUN apt-get install -y git wget xz-utils build-essential libyaml-dev
6
+
7
+ # Install Noto Fonts
8
+ RUN apt-get install -y fonts-noto
9
+
10
+ # Install Firefox
11
+ RUN apt-get install -y firefox-esr
12
+
13
+ # Install Geckodriver
14
+ RUN wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O geckodriver.tar.gz
15
+ RUN tar -xzf geckodriver.tar.gz -C /usr/local/bin
16
+
17
+ COPY . /app
18
+ WORKDIR /app
19
+ RUN bundle install
20
+ CMD ["bundle", "exec", "rspec"]
@@ -1,3 +1,4 @@
1
+ # syntax=docker/dockerfile:1
1
2
  FROM ubuntu:noble
2
3
 
3
4
  RUN apt-get update
@@ -0,0 +1,35 @@
1
+ # syntax=docker/dockerfile:1
2
+ FROM ubuntu:resolute
3
+
4
+ RUN apt-get update
5
+ RUN apt-get install -y ruby3.3 bundler
6
+ RUN apt-get install -y git wget xz-utils build-essential libyaml-dev
7
+
8
+ # Install Noto Fonts
9
+ RUN apt-get install -y fonts-noto
10
+
11
+ # Install Firefox
12
+ RUN wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
13
+ RUN tee /etc/apt/sources.list.d/mozilla.sources > /dev/null << EOF
14
+ Types: deb
15
+ URIs: https://packages.mozilla.org/apt
16
+ Suites: mozilla
17
+ Components: main
18
+ Signed-By: /etc/apt/keyrings/packages.mozilla.org.asc
19
+ EOF
20
+ RUN tee /etc/apt/preferences.d/mozilla > /dev/null << EOF
21
+ Package: *
22
+ Pin: origin packages.mozilla.org
23
+ Pin-Priority: 1000
24
+ EOF
25
+ RUN apt-get update
26
+ RUN apt-get install -y firefox
27
+
28
+ # Install Geckodriver
29
+ RUN wget "https://github.com/mozilla/geckodriver/releases/download/v0.36.0/geckodriver-v0.36.0-linux64.tar.gz" -O geckodriver.tar.gz
30
+ RUN tar -xzf geckodriver.tar.gz -C /usr/local/bin
31
+
32
+ COPY . /app
33
+ WORKDIR /app
34
+ RUN bundle install
35
+ CMD ["bundle", "exec", "rspec"]
data/docs/ForDeveloper.md CHANGED
@@ -2,16 +2,44 @@
2
2
 
3
3
  ## Test
4
4
 
5
+ ### Docker build
6
+
5
7
  ```bash
6
8
  $ docker build -f ./dockerfiles/Dockerfile.debian13-ruby32 . -t gkhtmltopdf-d13r32
7
9
  $ docker build -f ./dockerfiles/Dockerfile.ubuntu24-ruby32 . -t gkhtmltopdf-u24r32
10
+ $ docker build -f ./dockerfiles/Dockerfile.ubuntu26-ruby33 . -t gkhtmltopdf-u26r33
11
+ $ docker build -f ./dockerfiles/Dockerfile.debian13-ruby34 . -t gkhtmltopdf-d13r34
12
+ $ docker build -f ./dockerfiles/Dockerfile.debian13-ruby40 . -t gkhtmltopdf-d13r40
13
+ $ docker build -f ./dockerfiles/Dockerfile.amazonlinux2023-ruby32 . -t gkhtmltopdf-a23r32
14
+ ```
15
+
16
+ ### Docker run rspec
17
+
18
+ ```bash
8
19
  $ docker run --rm gkhtmltopdf-d13r32
9
20
  $ docker run --rm gkhtmltopdf-u24r32
21
+ $ docker run --rm gkhtmltopdf-u26r33
22
+ $ docker run --rm gkhtmltopdf-d13r34
23
+ $ docker run --rm gkhtmltopdf-d13r40
24
+ $ docker run --rm gkhtmltopdf-a23r32
25
+ ```
26
+
27
+ ### Docker remove image
28
+
29
+ ```bash
10
30
  $ docker rmi gkhtmltopdf-d13r32
11
31
  $ docker rmi gkhtmltopdf-u24r32
32
+ $ docker rmi gkhtmltopdf-u26r33
33
+ $ docker rmi gkhtmltopdf-d13r34
34
+ $ docker rmi gkhtmltopdf-d13r40
35
+ $ docker rmi gkhtmltopdf-a23r32
12
36
  ```
13
37
 
38
+ ---
39
+
14
40
  ## Build
15
41
 
16
- ```
42
+ ```bash
43
+ $ gem build gkhtmltopdf.gemspec
44
+ $ gem push ~.gem
17
45
  ```
@@ -0,0 +1,13 @@
1
+ # SupportList
2
+
3
+ Operation has been verified with the following OS and Ruby versions.
4
+ Please refer to the Dockerfile if you are unsure how to run the application.
5
+
6
+ | OS | Ruby| Link |
7
+ |----------------|-----|----------|
8
+ | Debian 13 |3.2.x| [Dockerfile](/dockerfiles/Dockerfile.debian13-ruby32) |
9
+ | Debian 13 |3.3.x| [Dockerfile](/dockerfiles/Dockerfile.debian13-ruby33) |
10
+ | Debian 13 |4.0.x| [Dockerfile](/dockerfiles/Dockerfile.debian13-ruby40) |
11
+ | Ubuntu 24.04 |3.2.x| [Dockerfile](/dockerfiles/Dockerfile.ubuntu24-ruby32) |
12
+ | Ubuntu 26.04 |3.3.x| [Dockerfile](/dockerfiles/Dockerfile.ubuntu26-ruby33) |
13
+ |AmazonLinux 2023|3.2.x| [Dockerfile](/dockerfiles/Dockerfile.amazonlinux2023-ruby32) |
data/exe/gkhtmltopdf CHANGED
@@ -6,7 +6,9 @@ require 'gkhtmltopdf'
6
6
 
7
7
  options = {
8
8
  print_options: {},
9
- firefox_prefs: {}
9
+ firefox_prefs: {},
10
+ gecko_stdout: File::NULL,
11
+ gecko_stderr: File::NULL
10
12
  }
11
13
 
12
14
  parser = OptionParser.new do |opts|
@@ -46,6 +48,14 @@ parser = OptionParser.new do |opts|
46
48
  options[:wait_time] = v
47
49
  end
48
50
 
51
+ opts.on("--stdout", "Show Geckodriver stdout") do |b|
52
+ options[:gecko_stdout] = b ? (STDOUT) : File::NULL
53
+ end
54
+
55
+ opts.on("--stderr", "Show Geckodriver stderr") do |b|
56
+ options[:gecko_stdout] = b ? (STDERR) : File::NULL
57
+ end
58
+
49
59
  opts.on("-v", "--version", "display version") do
50
60
  puts "Gkhtmltopdf version #{Gkhtmltopdf::VERSION}"
51
61
  exit
@@ -79,6 +89,8 @@ begin
79
89
  init_options[:geckodriver_path] = options.delete(:geckodriver_path) if options[:geckodriver_path]
80
90
  init_options[:wait_time] = options.delete(:wait_time) if options[:wait_time]
81
91
  init_options[:user_agent] = options.delete(:user_agent) if options[:user_agent]
92
+ init_options[:gecko_stdout] = options.delete(:gecko_stdout) if options[:gecko_stdout]
93
+ init_options[:gecko_stdout] = options.delete(:gecko_stdout) if options[:gecko_stdout]
82
94
 
83
95
  Gkhtmltopdf.convert(input_url, output_path, print_options: options[:print_options], **init_options)
84
96
 
@@ -12,12 +12,14 @@ module Gkhtmltopdf
12
12
  class Converter
13
13
  DEFAULT_FX_USER_AGENT = "gkhtmltopdf-rb(v#{VERSION}) by firefox and gecko".freeze
14
14
 
15
- def open(geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil)
15
+ def open(geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil, gecko_stdout: nil, gecko_stderr: nil)
16
16
  @geckodriver_path = resolve_geckodriver_path!(geckodriver_path)
17
17
  @firefox_path = resolve_firefox_path!(firefox_path)
18
18
  @port = port || get_free_port
19
19
  @base_url = "http://127.0.0.1:#{@port}"
20
- @pid = spawn("#{@geckodriver_path} --port #{@port}", out: File::NULL, err: File::NULL)
20
+ gecko_stdout = File::NULL if gecko_stdout.nil?
21
+ gecko_stderr = File::NULL if gecko_stderr.nil?
22
+ @pid = spawn("#{@geckodriver_path} --port #{@port}", out: gecko_stdout, err: gecko_stderr)
21
23
  wait_time ||= 20
22
24
  @profile_path = gen_tmp_profile(user_agent)
23
25
  wait_for_gk(wait_time)
@@ -45,6 +47,13 @@ module Gkhtmltopdf
45
47
  File.binwrite(output_path, Base64.decode64(pdf_base64))
46
48
  end
47
49
 
50
+ def pdf_binary(url, print_options: {})
51
+ validate_url_scheme!(url)
52
+ navigate(url)
53
+ pdf_base64 = print_pdf(print_options)
54
+ Base64.decode64(pdf_base64)
55
+ end
56
+
48
57
  private
49
58
 
50
59
  def get_free_port
@@ -17,5 +17,9 @@ module Gkhtmltopdf
17
17
  def save_pdf(url, output_path, print_options: {})
18
18
  @converter.save_pdf(url, output_path, print_options: print_options)
19
19
  end
20
+
21
+ def pdf_binary(url, print_options: {})
22
+ @converter.pdf_binary(url, print_options: print_options)
23
+ end
20
24
  end
21
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gkhtmltopdf
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
data/lib/gkhtmltopdf.rb CHANGED
@@ -6,17 +6,17 @@ require_relative 'gkhtmltopdf/dsl'
6
6
  require_relative 'errors'
7
7
 
8
8
  module Gkhtmltopdf
9
- def self.convert(url, output_path, geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil, print_options: {})
9
+ def self.convert(url, output_path, geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil, gecko_stdout: nil, gecko_stderr: nil, print_options: {})
10
10
  converter = DSL.new
11
- converter.open(geckodriver_path: geckodriver_path, firefox_path: firefox_path, wait_time: wait_time, port: port, user_agent: user_agent)
11
+ converter.open(geckodriver_path: geckodriver_path, firefox_path: firefox_path, wait_time: wait_time, port: port, user_agent: user_agent, gecko_stdout: gecko_stdout, gecko_stderr: gecko_stderr)
12
12
  converter.save_pdf(url, output_path, print_options: print_options)
13
13
  ensure
14
14
  converter.close
15
15
  end
16
16
 
17
- def self.open(geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil, &block)
17
+ def self.open(geckodriver_path: nil, firefox_path: nil, wait_time: nil, port: nil, user_agent: nil, gecko_stdout: nil, gecko_stderr: nil, &block)
18
18
  converter = DSL.new
19
- converter.open(geckodriver_path: geckodriver_path, firefox_path: firefox_path, wait_time: wait_time, port: port, user_agent: user_agent)
19
+ converter.open(geckodriver_path: geckodriver_path, firefox_path: firefox_path, wait_time: wait_time, port: port, user_agent: user_agent, gecko_stdout: gecko_stdout, gecko_stderr: gecko_stderr)
20
20
  yield converter
21
21
  ensure
22
22
  converter.close
@@ -29,6 +29,16 @@ RSpec.describe Gkhtmltopdf::Converter do
29
29
  expect(File.binread(output)).to include('/FontName')
30
30
  }
31
31
  end
32
+ describe '#pdf_binary' do
33
+ before { converter.open }
34
+ let(:url) { "file://#{file_fixture('test.html')}" }
35
+
36
+ subject { converter.pdf_binary(url) }
37
+
38
+ it {
39
+ is_expected.to include('/FontName')
40
+ }
41
+ end
32
42
  describe '#resolve_geckodriver_path!' do
33
43
  subject { converter.send(:resolve_geckodriver_path!, nil) }
34
44
  context 'geckodriver is not available' do
@@ -24,22 +24,41 @@ RSpec.describe Gkhtmltopdf do
24
24
  let(:url) { 'https://f6a.net/oss/' }
25
25
  let(:output_path) { Dir.mktmpdir }
26
26
  after { FileUtils.remove_entry_secure(output_path) }
27
+ describe '.save_pdf' do
28
+ subject do
29
+ Gkhtmltopdf.open do |gk|
30
+ (1..3).each { |n| gk.save_pdf("#{url}?test=#{n}", File.join(output_path, "#{n}.pdf")) }
31
+ end
32
+ end
27
33
 
28
- subject do
29
- Gkhtmltopdf.open do |gk|
30
- (1..3).each { |n| gk.save_pdf("#{url}?test=#{n}", File.join(output_path, "#{n}.pdf")) }
34
+ it 'successful conversion' do
35
+ expect { subject }.to change { Dir.glob(File.join(output_path, '*.pdf')).count }.from(0).to(3)
36
+ expect { subject }.not_to raise_error
31
37
  end
32
- end
33
38
 
34
- it 'successful conversion' do
35
- expect { subject }.to change { Dir.glob(File.join(output_path, '*.pdf')).count }.from(0).to(3)
36
- expect { subject }.not_to raise_error
39
+ context 'invalid URL' do
40
+ let(:url) { 'ftp://example.com' }
41
+ it 'raises an error' do
42
+ expect { subject }.to raise_error(Gkhtmltopdf::URLSchemeInvalid, 'Invalid URL scheme: (ftp)')
43
+ end
44
+ end
37
45
  end
38
-
39
- context 'invalid URL' do
40
- let(:url) { 'ftp://example.com' }
41
- it 'raises an error' do
42
- expect { subject }.to raise_error(Gkhtmltopdf::URLSchemeInvalid, 'Invalid URL scheme: (ftp)')
46
+ describe '.pdf_binary' do
47
+ subject do
48
+ Gkhtmltopdf.open do |gk|
49
+ pdf_binary = gk.pdf_binary("#{url}?test=binary")
50
+ pdf_binary.bytesize
51
+ end
52
+ end
53
+ it 'successful conversion' do
54
+ is_expected.to be > 1000
55
+ expect { subject }.not_to raise_error
56
+ end
57
+ context 'invalid URL' do
58
+ let(:url) { 'ftp://example.com' }
59
+ it 'raises an error' do
60
+ expect { subject }.to raise_error(Gkhtmltopdf::URLSchemeInvalid, 'Invalid URL scheme: (ftp)')
61
+ end
43
62
  end
44
63
  end
45
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gkhtmltopdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Sakane
@@ -82,9 +82,14 @@ files:
82
82
  - README.md
83
83
  - Rakefile
84
84
  - TODO.md
85
+ - dockerfiles/Dockerfile.amazonlinux2023-ruby32
85
86
  - dockerfiles/Dockerfile.debian13-ruby32
87
+ - dockerfiles/Dockerfile.debian13-ruby34
88
+ - dockerfiles/Dockerfile.debian13-ruby40
86
89
  - dockerfiles/Dockerfile.ubuntu24-ruby32
90
+ - dockerfiles/Dockerfile.ubuntu26-ruby33
87
91
  - docs/ForDeveloper.md
92
+ - docs/SupportList.md
88
93
  - exe/gkhtmltopdf
89
94
  - lib/errors.rb
90
95
  - lib/gkhtmltopdf.rb