pdfzus-zusammenfuegen-cli 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8226950f7f452293ab6eb5eaa5b48b9ea8db26945d7584f6b0015acc27f6a7ee
4
+ data.tar.gz: 49b462d5a79ecdc030cbec33b940a7190d4e2a20ac8325f9436765cf1dc2afdf
5
+ SHA512:
6
+ metadata.gz: e635c0f3187c6a9cad48a4f21781b5fd367bb8c37a59d4e53c7ea2077913469b73c5147085261d512bba903f42adec67cfb38c4dad36358519aa9dc0a610f9b1
7
+ data.tar.gz: f453e93d00bbc1662336e4f386bb3cb7d09746164000a524fdbc123822299c0e7099153e1da7aa55784976086f16abb2228583cffd07791c547735dbcd18c179
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pdfzus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # pdfzus-zusammenfuegen-cli
2
+
3
+ `pdfzus-zusammenfuegen-cli` ist ein praktisches Ruby-Tool, um mehrere PDF-Dateien in definierter Reihenfolge zusammenzufuegen.
4
+
5
+ Homepage: https://pdfzus.de/
6
+
7
+ ## Funktionen
8
+
9
+ - Fuegt mehrere PDF-Dateien stabil in Eingabereihenfolge zusammen
10
+ - Nutzbar als Ruby-API fuer Automatisierung
11
+ - CLI fuer schnelle Terminal-Workflows
12
+ - Klare Fehlerausgaben bei ungueltigen Eingaben
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ gem install pdfzus-zusammenfuegen-cli
18
+ ```
19
+
20
+ ## CLI Nutzung
21
+
22
+ ```bash
23
+ pdfzus-merge -o merged.pdf a.pdf b.pdf c.pdf
24
+ ```
25
+
26
+ ## Ruby API Nutzung
27
+
28
+ ```ruby
29
+ require "pdfzus-zusammenfuegen-cli"
30
+
31
+ out = Pdfzus::Zusammenfuegen.merge_pdfs(
32
+ inputs: ["a.pdf", "b.pdf"],
33
+ output: "merged.pdf"
34
+ )
35
+
36
+ puts out
37
+ ```
38
+
39
+ ## Exit Codes
40
+
41
+ - `0`: Erfolg
42
+ - `2`: Ungueltige Parameter oder unlesbare Dateien
data/exe/pdfzus-merge ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "optparse"
5
+ require "pdfzus-zusammenfuegen-cli"
6
+
7
+ options = {}
8
+
9
+ parser = OptionParser.new do |opts|
10
+ opts.banner = "Usage: pdfzus-merge -o OUTPUT.pdf INPUT1.pdf INPUT2.pdf [INPUT3.pdf ...]"
11
+ opts.on("-o", "--output FILE", "Pfad fuer die Ausgabe-PDF") { |v| options[:output] = v }
12
+ opts.on("-h", "--help", "Zeigt Hilfe") do
13
+ puts opts
14
+ exit 0
15
+ end
16
+ end
17
+
18
+ begin
19
+ parser.parse!(ARGV)
20
+
21
+ if options[:output].nil? || ARGV.length < 2
22
+ warn parser.to_s
23
+ exit 2
24
+ end
25
+
26
+ output = Pdfzus::Zusammenfuegen.merge_pdfs(inputs: ARGV, output: options[:output])
27
+ puts "Zusammengefuegte PDF erstellt: #{output}"
28
+ exit 0
29
+ rescue OptionParser::ParseError, ArgumentError, Pdfzus::Zusammenfuegen::Error => e
30
+ warn "Fehler: #{e.message}"
31
+ exit 2
32
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pdfzus
4
+ module Zusammenfuegen
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "combine_pdf"
4
+ require "fileutils"
5
+ require_relative "zusammenfuegen/version"
6
+
7
+ module Pdfzus
8
+ module Zusammenfuegen
9
+ class Error < StandardError; end
10
+
11
+ module_function
12
+
13
+ def merge_pdfs(inputs:, output:)
14
+ raise ArgumentError, "Mindestens 2 Eingabe-PDFs sind erforderlich." if inputs.length < 2
15
+ raise ArgumentError, "Output muss auf .pdf enden." unless output.downcase.end_with?(".pdf")
16
+
17
+ normalized_inputs = inputs.map do |raw|
18
+ path = File.expand_path(raw)
19
+ raise ArgumentError, "Datei nicht gefunden: #{raw}" unless File.file?(path)
20
+ raise ArgumentError, "Keine PDF-Datei: #{raw}" unless path.downcase.end_with?(".pdf")
21
+
22
+ path
23
+ end
24
+
25
+ output_path = File.expand_path(output)
26
+ FileUtils.mkdir_p(File.dirname(output_path))
27
+
28
+ merged = CombinePDF.new
29
+ normalized_inputs.each do |pdf_path|
30
+ merged << CombinePDF.load(pdf_path)
31
+ rescue StandardError => e
32
+ raise Error, "PDF konnte nicht gelesen werden (#{pdf_path}): #{e.message}"
33
+ end
34
+
35
+ merged.save(output_path)
36
+ output_path
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "pdfzus/zusammenfuegen"
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pdfzus-zusammenfuegen-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - pdfzus
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: combine_pdf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ description: Ein praktisches Gem fuer das sichere Zusammenfuegen von PDF-Dateien in
56
+ fester Reihenfolge.
57
+ email:
58
+ - support2@pdfzus.de
59
+ executables:
60
+ - pdfzus-merge
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - LICENSE
65
+ - README.md
66
+ - exe/pdfzus-merge
67
+ - lib/pdfzus-zusammenfuegen-cli.rb
68
+ - lib/pdfzus/zusammenfuegen.rb
69
+ - lib/pdfzus/zusammenfuegen/version.rb
70
+ homepage: https://pdfzus.de/
71
+ licenses:
72
+ - MIT
73
+ metadata:
74
+ homepage_uri: https://pdfzus.de/
75
+ allowed_push_host: https://rubygems.org
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '2.6'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubygems_version: 3.0.3.1
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: PDF zusammenfuegen per Ruby CLI und API.
95
+ test_files: []