summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-05-24 16:31:47 -0600
committerGitHub <noreply@github.com>2022-05-24 16:31:47 -0600
commit0748ca78a049efca35f18c40b65d749d3171b929 (patch)
tree84a34e45e9425295b12ce213b028999f65cd09b3 /spec
parent6c3a443200d4ce7f71e237c53f37d91a9f80048d (diff)
resolves #2203 adjust TrimBox to fit inside of BleedBox when using optimizer and compliance is PDF/X (PR #2204)
Diffstat (limited to 'spec')
-rw-r--r--spec/optimizer_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/optimizer_spec.rb b/spec/optimizer_spec.rb
index d630e3e5..c770d4a3 100644
--- a/spec/optimizer_spec.rb
+++ b/spec/optimizer_spec.rb
@@ -86,7 +86,7 @@ describe 'Asciidoctor::PDF::Optimizer', if: (gem_available? 'rghost'), &(proc do
end).to not_raise_exception
end
- it 'should generate PDF that conforms to specified PDF/A compliance' do
+ it 'should generate PDF that conforms to specified compliance' do
input_file = Pathname.new example_file 'basic-example.adoc'
to_file = to_pdf_file input_file, 'optimizer-screen-pdf-a.pdf', attribute_overrides: { 'optimize' => 'PDF/A' }
pdf = PDF::Reader.new to_file
@@ -96,6 +96,20 @@ describe 'Asciidoctor::PDF::Optimizer', if: (gem_available? 'rghost'), &(proc do
(expect get_annotations pdf, 1).to be_empty
end
+ # NOTE: I can't figure out a way to capture the stderr in this case without using the CLI
+ it 'should not fail to produce PDF/X compliant document if specified', cli: true do
+ out, err, res = run_command asciidoctor_pdf_bin, '-a', 'optimize=PDF/X', '-o', (to_file = output_file 'optimizer-screen-pdf-x.pdf'), (example_file 'basic-example.adoc')
+ (expect res.exitstatus).to be 0
+ (expect out).to be_empty
+ (expect err).not_to include 'TrimBox does not fit inside BleedBox'
+ (expect err).to be_empty
+ pdf = PDF::Reader.new to_file
+ (expect pdf.pdf_version).to eql 1.3
+ (expect pdf.pages).to have_size 1
+ # Non-printing annotations (i.e., hyperlinks) are not permitted in PDF/X
+ (expect get_annotations pdf, 1).to be_empty
+ end
+
it 'should generate PDF that conforms to specified PDF/A compliance when quality is specified' do
input_file = Pathname.new example_file 'basic-example.adoc'
to_file = to_pdf_file input_file, 'optimizer-print-pdf-a.pdf', attribute_overrides: { 'optimize' => 'print,PDF/A' }