docpdf 0.1.1 → 0.1.3

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: a9a3844a80c86805181447cad01e111d2ca0b3ad5d3292d5d8fd77878dee9939
4
- data.tar.gz: 2a601b3605a2c1aca09225725ff4de90c5bfe8e381c3f2427437f8d4c89a2227
3
+ metadata.gz: 5e538a07522f58d49b6184ea61c232254d2c70bd9baab1ab45339c5be870a789
4
+ data.tar.gz: ff245f05c704f6b4a9fdb17bba0ca80605d90a92f5e1d147c3d8356ab7f0fd8d
5
5
  SHA512:
6
- metadata.gz: ad6e2bd0ac9071a41a3f970739cafca0e6fc8046581167442511028db4725f9fd58346c39731899ec3434be7078a3e56baee8735a07616da6d3cbc864f3ddd94
7
- data.tar.gz: 1d730600c99a33383dd4d0948392d25bd43d995be33a473e910eb2dd06ec6fc84264966a72bd52dca41542e12e848d51a5b2a18431b9981c99f0ea7288a8ab15
6
+ metadata.gz: 2e2af68bbc8d8d7ba4a5e4492bb5975fe04cb327b0517f79d20cbba14af60cbe441b6b111ac0bfa65fe3632c9ee9e8c9ad4680e03f1c946a83cfdd535ee63c37
7
+ data.tar.gz: c9072fa249e9365b7bc1f3a7053fc6e0aeb2897a086f0ff8192544a9d7f27bd69b9975b84e68372298ea01e62dd9a94069d0e59cbb03c8984f61c66521c18e4b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.3] - 2026-04-04
4
+
5
+ ### Improved
6
+ - Error messages now include the mime type that failed and which gems to install
7
+ - Unknown stamper errors list valid options from the registry
8
+ - All gem names in error messages are pulled from the registry, not hardcoded
9
+
10
+ ## [0.1.2] - 2026-04-04
11
+
12
+ ### Fixed
13
+ - Concurrent LibreOffice conversions no longer conflict. Each conversion uses an isolated user profile directory via `-env:UserInstallation`, preventing lock file collisions under load.
14
+
3
15
  ## [0.1.1] - 2026-04-03
4
16
 
5
17
  ### Fixed
data/README.md CHANGED
@@ -1,7 +1,18 @@
1
- # DocPDF
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset=".github/logo-dark.svg">
3
+ <img src=".github/logo-light.svg" alt="DocPDF" width="200" align="left">
4
+ </picture>
5
+
6
+ <br/>
7
+ <br/>
2
8
 
3
9
  Convert documents from any common format to PDF, with optional watermarking. Zero hard dependencies; bring your own PDF library.
4
10
 
11
+ [![CI](https://github.com/velocity-labs/docpdf/actions/workflows/ci.yml/badge.svg)](https://github.com/velocity-labs/docpdf/actions/workflows/ci.yml)
12
+ [![Gem Version](https://badge.fury.io/rb/docpdf.svg)](https://rubygems.org/gems/docpdf)
13
+
14
+ <br clear="left">
15
+
5
16
  ## Supported Formats
6
17
 
7
18
  | Input Format | Conversion Tool | Ruby Gem Required |
@@ -30,8 +30,11 @@ module DocPDF
30
30
  tempfile.rewind
31
31
 
32
32
  soffice = DocPDF.configuration.soffice_path
33
+ profile_dir = File.join(output_dir, "profile")
33
34
  stderr_path = File.join(output_dir, "stderr.log")
34
- success = system(soffice, "--headless", "--convert-to", "pdf",
35
+ success = system(soffice, "--headless",
36
+ "-env:UserInstallation=file://#{profile_dir}",
37
+ "--convert-to", "pdf",
35
38
  "--outdir", output_dir, tempfile.path,
36
39
  out: File::NULL, err: stderr_path)
37
40
 
@@ -8,13 +8,22 @@ module DocPDF
8
8
  end
9
9
 
10
10
  def resolve(mime_type)
11
+ missing_gems = []
12
+
11
13
  @adapters.each do |entry|
12
14
  next unless entry[:mime_types].include?(mime_type)
13
15
  require entry[:require_name] if entry[:require_name]
14
16
  return entry[:loader].call
15
17
  rescue LoadError
18
+ missing_gems << entry[:require_name]
16
19
  next
17
20
  end
21
+
22
+ if missing_gems.any?
23
+ gem_list = missing_gems.map { |g| "'#{g}'" }.join(" or ")
24
+ raise AdapterNotFoundError, "No converter found for #{mime_type}. Install #{gem_list} and add it to your Gemfile."
25
+ end
26
+
18
27
  resolve_fallback
19
28
  end
20
29
 
@@ -22,7 +31,7 @@ module DocPDF
22
31
 
23
32
  def resolve_fallback
24
33
  entry = @adapters.find { |e| e[:name] == :fallback }
25
- raise AdapterNotFoundError, "No converter found and no fallback registered" unless entry
34
+ raise AdapterNotFoundError, "No converter found and no fallback registered." unless entry
26
35
  entry[:loader].call
27
36
  end
28
37
  end
@@ -10,13 +10,7 @@ module DocPDF
10
10
  def resolve
11
11
  configured = DocPDF.configuration.stamper
12
12
  if configured
13
- entry = @adapters.find { |e| e[:name] == configured }
14
- raise AdapterNotFoundError, "Unknown stamper: #{configured}" unless entry
15
- begin
16
- entry[:loader].call
17
- rescue LoadError => e
18
- raise AdapterNotFoundError, "Stamper '#{configured}' requires gems that are not available: #{e.message}"
19
- end
13
+ resolve_configured(configured)
20
14
  else
21
15
  auto_detect
22
16
  end
@@ -30,7 +24,19 @@ module DocPDF
30
24
  rescue LoadError
31
25
  next
32
26
  end
33
- raise AdapterNotFoundError, "No stamper available. Add 'hexapdf' or 'combine_pdf' (with 'prawn') to your Gemfile."
27
+ names = @adapters.map { |e| "'#{e[:name]}'" }.join(" or ")
28
+ raise AdapterNotFoundError, "No stamper available. Add #{names} to your Gemfile."
29
+ end
30
+
31
+ def resolve_configured(name)
32
+ entry = @adapters.find { |e| e[:name] == name }
33
+ valid_names = @adapters.map { |e| e[:name].inspect }.join(", ")
34
+ raise AdapterNotFoundError, "Unknown stamper: #{name.inspect}. Valid stampers are: #{valid_names}." unless entry
35
+ begin
36
+ entry[:loader].call
37
+ rescue LoadError => e
38
+ raise AdapterNotFoundError, "Stamper #{name.inspect} requires gems that are not installed: #{e.message}"
39
+ end
34
40
  end
35
41
  end
36
42
 
@@ -1,3 +1,3 @@
1
1
  module DocPDF
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docpdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Velocity Labs, LLC