qpdf_ruby 0.1.1 β†’ 0.3.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.
data/sig/qpdf_ruby.rbs CHANGED
@@ -1,4 +1,85 @@
1
1
  module QpdfRuby
2
2
  VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
3
+
4
+ ENCRYPTION_REVISION_AES_128: Integer
5
+ ENCRYPTION_REVISION_AES_256: Integer
6
+ ENCRYPTION_REVISION_AES_256U: Integer
7
+ PRINT_FULL: Integer
8
+ PRINT_LOW: Integer
9
+ PRINT_NONE: Integer
10
+
11
+ class Error < RuntimeError
12
+ end
13
+
14
+ class Document
15
+ type untagged_counts = {
16
+ paths: Integer,
17
+ texts: Integer,
18
+ xobjects: Integer,
19
+ shadings: Integer,
20
+ inline_images: Integer,
21
+ total: Integer
22
+ }
23
+
24
+ type pdfua_report = {
25
+ decorations: Integer,
26
+ artifacts: untagged_counts,
27
+ links: Integer,
28
+ list_bodies: Integer,
29
+ roles: Integer,
30
+ figure_groups: Integer,
31
+ figures_without_alt: Integer,
32
+ identified: bool,
33
+ unidentified_reason: String?
34
+ }
35
+
36
+ type document_info_result = { changed: bool, xmp_error: String? }
37
+
38
+ type link = { page: Integer, uri: String?, contents: String? }
39
+
40
+ def self.from_memory: (String data, ?String? password) -> Document
41
+
42
+ def initialize: (String filename, ?String? password) -> void
43
+
44
+ def write: (String filename) -> nil
45
+ def to_memory: () -> String
46
+
47
+ def show_structure: () -> String
48
+ def ensure_bbox: () -> nil
49
+
50
+ def apply_pdfua_fixes: (?link_texts: Hash[untyped, untyped]?, ?title: String?) -> pdfua_report
51
+ def mark_untagged_content_as_artifacts: () -> untagged_counts
52
+ # deprecated: use #mark_untagged_content_as_artifacts
53
+ def mark_paths_as_artifacts: () -> untagged_counts
54
+ def untagged_content: () -> untagged_counts
55
+ def describe_links: (?Hash[untyped, untyped]? texts) -> Integer
56
+ def artifact_tagged_decorations: () -> Integer
57
+ def wrap_list_bodies: () -> Integer
58
+ def parent_tree_mismatches: () -> Integer
59
+ def map_nonstandard_roles: () -> Integer
60
+ def retag_grouping_figures: () -> Integer
61
+ def figures_without_alt: () -> Integer
62
+ def add_pdfua_identification: (?title: String?) -> bool
63
+ def set_document_info: (?creator: String?, ?producer: String?) -> document_info_result
64
+
65
+ def links: () -> Array[link]
66
+ def metadata: () -> String?
67
+ def document_info: () -> Hash[String, String]
68
+ def role_map: () -> Hash[String, String]
69
+
70
+ def encrypt: (
71
+ ?user_pw: String,
72
+ ?owner_pw: String,
73
+ ?encryption_revision: Integer,
74
+ ?allow_print: Integer,
75
+ ?allow_modify: boolish,
76
+ ?allow_extract: boolish,
77
+ ?accessibility: boolish,
78
+ ?assemble: boolish,
79
+ ?annotate_and_form: boolish,
80
+ ?form_filling: boolish,
81
+ ?encrypt_metadata: boolish,
82
+ ?use_aes: boolish
83
+ ) -> nil
84
+ end
4
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qpdf_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dieter S.
@@ -130,36 +130,35 @@ extensions:
130
130
  - ext/qpdf_ruby/extconf.rb
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - ".clang-format"
134
- - ".rspec"
135
- - ".rubocop.yml"
136
- - ".ruby-gemset"
137
- - ".ruby-version"
138
133
  - CHANGELOG.md
139
134
  - LICENSE.txt
140
135
  - README.md
141
- - Rakefile
142
- - cliff.toml
143
- - docker/Dockerfile
144
136
  - exe/qpdf_ruby
145
137
  - ext/qpdf_ruby/array_node.cpp
146
138
  - ext/qpdf_ruby/document_handle.cpp
147
139
  - ext/qpdf_ruby/document_handle.hpp
148
140
  - ext/qpdf_ruby/extconf.rb
149
141
  - ext/qpdf_ruby/figure_node.cpp
142
+ - ext/qpdf_ruby/mcid_bounds.cpp
143
+ - ext/qpdf_ruby/mcid_bounds.hpp
150
144
  - ext/qpdf_ruby/mcid_node.cpp
151
145
  - ext/qpdf_ruby/mcr_node.cpp
152
- - ext/qpdf_ruby/pdf_image_mapper.cpp
153
- - ext/qpdf_ruby/pdf_image_mapper.hpp
154
146
  - ext/qpdf_ruby/pdf_struct_walker.cpp
155
147
  - ext/qpdf_ruby/pdf_struct_walker.hpp
148
+ - ext/qpdf_ruby/pdfua.cpp
149
+ - ext/qpdf_ruby/pdfua.hpp
156
150
  - ext/qpdf_ruby/qpdf_ruby.cpp
157
151
  - ext/qpdf_ruby/qpdf_ruby.hpp
152
+ - ext/qpdf_ruby/ruby_guard.hpp
158
153
  - ext/qpdf_ruby/stream_node.cpp
154
+ - ext/qpdf_ruby/stroke_bounds.cpp
155
+ - ext/qpdf_ruby/stroke_bounds.hpp
159
156
  - ext/qpdf_ruby/struct_elem_node.cpp
160
157
  - ext/qpdf_ruby/struct_node.cpp
161
158
  - ext/qpdf_ruby/struct_node.hpp
162
159
  - ext/qpdf_ruby/unknown_node.cpp
160
+ - ext/qpdf_ruby/xmp_scan.cpp
161
+ - ext/qpdf_ruby/xmp_scan.hpp
163
162
  - lib/qpdf_ruby.rb
164
163
  - lib/qpdf_ruby/version.rb
165
164
  - sig/qpdf_ruby.rbs
@@ -186,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
185
  - !ruby/object:Gem::Version
187
186
  version: '0'
188
187
  requirements: []
189
- rubygems_version: 3.6.8
188
+ rubygems_version: 4.0.20
190
189
  specification_version: 4
191
190
  summary: A Ruby interface .
192
191
  test_files: []
data/.clang-format DELETED
@@ -1,4 +0,0 @@
1
- BasedOnStyle: Google
2
- SortIncludes: false
3
- IndentWidth: 2
4
- ColumnLimit: 120
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,88 +0,0 @@
1
- AllCops:
2
- NewCops: enable
3
- TargetRubyVersion: 3.3
4
- Exclude:
5
- - 'ext/qpdf_ruby/extconf.rb'
6
- - 'tmp/**/*'
7
- - 'vendor/**/*'
8
-
9
- Style/StringLiterals:
10
- EnforcedStyle: double_quotes
11
-
12
- Style/StringLiteralsInInterpolation:
13
- EnforcedStyle: double_quotes
14
-
15
- Style/Documentation:
16
- Enabled: false
17
-
18
- RSpec/SubjectStub:
19
- Enabled: false
20
-
21
- RSpec/ExampleLength:
22
- Enabled: false
23
-
24
- Layout/MultilineMethodCallIndentation:
25
- Enabled: false
26
-
27
- Layout/FirstArgumentIndentation:
28
- Enabled: false
29
-
30
- Layout/ClosingParenthesisIndentation:
31
- Enabled: false
32
-
33
- Layout/FirstHashElementIndentation:
34
- EnforcedStyle: consistent
35
-
36
- Layout/FirstArrayElementIndentation:
37
- Enabled: false
38
-
39
- Layout/MultilineOperationIndentation:
40
- Enabled: false
41
-
42
- Layout/BeginEndAlignment:
43
- Enabled: false
44
-
45
- Layout/ArrayAlignment:
46
- Enabled: false
47
-
48
- Layout/LineLength:
49
- Enabled: false
50
-
51
- Layout/LineEndStringConcatenationIndentation:
52
- Enabled: false
53
-
54
- RSpec/MultipleMemoizedHelpers:
55
- Max: 10
56
-
57
- Metrics/MethodLength:
58
- Enabled: false
59
-
60
- Metrics/ClassLength:
61
- Enabled: false
62
-
63
- Metrics/ParameterLists:
64
- Max: 10
65
-
66
-
67
- Gemspec/DevelopmentDependencies:
68
- EnforcedStyle: gemspec
69
-
70
- RSpec/InstanceVariable:
71
- Enabled: false
72
-
73
- RSpec/BeforeAfterAll:
74
- Enabled: false
75
-
76
- RSpec/SpecFilePathFormat:
77
- Enabled: true
78
- Exclude:
79
- - 'spec/acceptance/**/*_spec.rb'
80
-
81
- RSpec/DescribeClass:
82
- Enabled: true
83
- Exclude:
84
- - 'spec/acceptance/**/*_spec.rb'
85
-
86
- plugins:
87
- - rubocop-rake
88
- - rubocop-rspec
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- qpdf_ruby
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-3.3.4
data/Rakefile DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require "rubocop/rake_task"
9
-
10
- RuboCop::RakeTask.new
11
-
12
- require "rake/extensiontask"
13
-
14
- desc "Build the gem including native extensions"
15
- task build: :compile
16
-
17
- GEMSPEC = Gem::Specification.load("qpdf_ruby.gemspec")
18
-
19
- Rake::ExtensionTask.new("qpdf_ruby", GEMSPEC) do |ext|
20
- ext.lib_dir = "lib/qpdf_ruby"
21
- end
22
-
23
- Dir.glob("tasks/*.rake").each { |r| load r }
24
-
25
- task default: %i[clobber compile spec rubocop]
data/cliff.toml DELETED
@@ -1,138 +0,0 @@
1
- # git-cliff ~ configuration file
2
- # https://git-cliff.org/docs/configuration
3
-
4
- [changelog]
5
- # template for the changelog header
6
- header = """
7
- <!-- generated by git-cliff start -->
8
- # Changelog\n
9
- All notable changes to this project will be documented in this file.
10
-
11
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
12
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n
13
- """
14
- # template for the changelog body
15
- # https://keats.github.io/tera/docs/#introduction
16
- body = """
17
- {%- macro remote_url() -%}
18
- https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
19
- {%- endmacro -%}
20
-
21
- {% if version -%}
22
- ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
23
- {% else -%}
24
- ## [Unreleased]
25
- {% endif -%}
26
-
27
- {% for group, commits in commits | group_by(attribute="group") %}
28
- ### {{ group | upper_first }}
29
- {%- for commit in commits %}
30
- - {{ commit.message | split(pat="\n") | first | upper_first | trim }}\
31
- {% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
32
- {% if commit.remote.pr_number %} in \
33
- [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) \
34
- {%- endif -%}
35
- {% endfor %}
36
- {% endfor %}
37
-
38
- {%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
39
- ## New Contributors
40
- {%- endif -%}
41
-
42
- {% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
43
- * @{{ contributor.username }} made their first contribution
44
- {%- if contributor.pr_number %} in \
45
- [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
46
- {%- endif %}
47
- {%- endfor %}\n
48
- """
49
- # template for the changelog footer
50
- footer = """
51
- {%- macro remote_url() -%}
52
- https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
53
- {%- endmacro -%}
54
-
55
- {% for release in releases -%}
56
- {% if release.version -%}
57
- {% if release.previous.version -%}
58
- [{{ release.version | trim_start_matches(pat="v") }}]: \
59
- {{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }}
60
- {% endif -%}
61
- {% else -%}
62
- [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD
63
- {% endif -%}
64
- {% endfor %}
65
- <!-- generated by git-cliff end -->
66
- """
67
- # remove the leading and trailing whitespace from the templates
68
- trim = true
69
-
70
- [git]
71
- # parse the commits based on https://www.conventionalcommits.org
72
- conventional_commits = true
73
- # filter out the commits that are not conventional
74
- filter_unconventional = false
75
- # regex for preprocessing the commit messages
76
- commit_preprocessors = [
77
- # remove issue numbers from commits
78
- { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
79
- ]
80
- # regex for parsing and grouping commits
81
- commit_parsers = [
82
- # βœ… Features (additions)
83
- { message = "^feat(?:\\([^)]+\\))?!?:", group = "πŸš€ Added" },
84
- { message = "^[aA]dd", group = "πŸš€ Added" },
85
- { message = "^[sS]upport", group = "πŸš€ Added" },
86
-
87
- # ❌ Removals
88
- { message = "^[rR]emove", group = "πŸ—‘οΈ Removed" },
89
- { message = "^[dD]elete", group = "πŸ—‘οΈ Removed" },
90
-
91
- # πŸ› Fixes
92
- { message = "^fix(?:\\([^)]+\\))?!?:", group = "πŸ› Fixed" },
93
- { message = "^[tT]est", group = "πŸ› Fixed" },
94
- { message = "^[fF]ix", group = "πŸ› Fixed" },
95
-
96
- # 🎨 Refactors
97
- { message = "^refactor(?:\\([^)]+\\))?!?:", group = "🎨 Refactored" },
98
-
99
- # ⚑️ Performance
100
- { message = "^perf(?:\\([^)]+\\))?!?:", group = "⚑️ Performance" },
101
-
102
- # πŸ“ Docs
103
- { message = "^docs(?:\\([^)]+\\))?!?:", group = "πŸ“ Docs" },
104
-
105
- # πŸ’„ Style (formatting, whitespace, etc.)
106
- { message = "^style(?:\\([^)]+\\))?!?:", group = "πŸ’„ Style" },
107
-
108
- # πŸ§ͺ Tests
109
- { message = "^test(?:\\([^)]+\\))?!?:", group = "πŸ§ͺ Tests" },
110
-
111
- # πŸ”§ Build
112
- { message = "^build(?:\\([^)]+\\))?!?:", group = "πŸ”§ Build" },
113
-
114
- # πŸ› οΈ CI
115
- { message = "^ci(?:\\([^)]+\\))?!?:", skip = true },
116
-
117
- # 🧹 Chores (skip)
118
- { message = "^chore\\(release\\): prepare for", skip = true },
119
- { message = "^chore\\(deps.*\\)", skip = true },
120
- { message = "^chore\\(pr\\)", skip = true },
121
- { message = "^chore\\(pull\\)", skip = true },
122
- { message = "^chore(?:\\([^)]+\\))?!?:", skip = true },
123
- { message = "^\\s*chore", skip = true },
124
-
125
- # βͺ Reverts
126
- { message = "^revert(?:\\([^)]+\\))?!?:", group = "βͺ Reverted" },
127
-
128
- # πŸŒ€ Catch-all (only if nothing else matched)
129
- { message = "^.*", group = "πŸ”„ Changed" }
130
- ]
131
-
132
-
133
- # filter out the commits that are not matched by commit parsers
134
- filter_commits = false
135
- # sort the tags topologically
136
- topo_order = false
137
- # sort the commits inside sections by oldest/newest order
138
- sort_commits = "newest"
data/docker/Dockerfile DELETED
@@ -1,46 +0,0 @@
1
- FROM ruby:3.3
2
-
3
- ENV DEBIAN_FRONTEND=noninteractive
4
-
5
- RUN set -eux; \
6
- echo "deb http://deb.debian.org/debian testing main" > /etc/apt/sources.list.d/extra.list; \
7
- echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list.d/extra.list; \
8
- \
9
- printf "Package: *\nPin: release a=testing\nPin-Priority: 100\n\n" > /etc/apt/preferences.d/99-pin-testing; \
10
- printf "Package: *\nPin: release a=unstable\nPin-Priority: 100\n" >> /etc/apt/preferences.d/99-pin-testing; \
11
- \
12
- apt-get update; \
13
- apt-get -y --no-install-recommends install qpdf libqpdf-dev -t testing; \
14
- apt-mark hold qpdf libqpdf-dev; \
15
- \
16
- apt-get clean; rm -rf /var/lib/apt/lists/*;
17
-
18
- # Smoke‑test (shown in build log)
19
- RUN qpdf --version # should print "qpdf version 12.x"
20
-
21
-
22
- COPY ./pkg/qpdf_ruby-*.gem ./
23
- COPY ./spec/fixtures/example_accessibility.pdf /tmp/dummy.pdf
24
-
25
- RUN gem install ./qpdf_ruby-*.gem -- --with-qpdf-include=/usr/local/include/qpdf --with-qpdf-lib=/usr/local/lib
26
-
27
- RUN ruby -r qpdf_ruby -e 'puts "QpdfRuby version: #{QpdfRuby::VERSION}";doc = QpdfRuby::Document.new "/tmp/dummy.pdf"; puts doc.show_structure'
28
-
29
- # Create a non-root user
30
- RUN set -eux; \
31
- groupadd -r appuser && useradd -r -g appuser -m -d /home/appuser appuser
32
-
33
-
34
- RUN set -eux; \
35
- mkdir -p /workspace
36
-
37
- # Set working directory
38
- WORKDIR /workspace
39
-
40
- RUN chown -R appuser:appuser /workspace
41
-
42
- # Switch to non-root user
43
- USER appuser
44
-
45
- CMD ["/usr/bin/bash"]
46
-