-
Notifications
You must be signed in to change notification settings - Fork 165
/
Copy pathautomated
executable file
·71 lines (59 loc) · 2.69 KB
/
automated
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env ruby
require 'benchmark'
$LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), __FILE__)
require 'combine_pdf'
require 'bundler/setup'
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start
pdf = CombinePDF.load "./Ruby/test\ pdfs/filled_form.pdf"
pdf.save '01_check_radio_buttuns.pdf'
pdf << CombinePDF.load("./Ruby/test\ pdfs/empty_form.pdf")
pdf << CombinePDF.load("./Ruby/test\ pdfs/filled_form.pdf")
pdf.save '02_check_form_unification_middle_is_empty.pdf'
pdf = CombinePDF.load "./Ruby/test pdfs/share-font-background.pdf"
pdf2 = CombinePDF.load "./Ruby/test pdfs/share-font-foreground.pdf"
i = 0
pdf.pages.each {|pg| pg << pdf2.pages[i]}
pdf.save '03_check_font_conflict.pdf'
pdf = CombinePDF.load "./Ruby/test pdfs/names_go_haywire_0.pdf"
pdf << CombinePDF.load("./Ruby/test pdfs/names_go_haywire_1.pdf")
pdf.save '04_check_view_and_names_reference.pdf'
# pdf = CombinePDF.load "./Ruby/test pdfs/named_dest.pdf";nil
# pdf.save '05_check_named_dest_links.pdf' # this will take a while
# pdf = CombinePDF.load "./Ruby/test pdfs/named_dest.pdf";nil
# pdf << CombinePDF.load("./Ruby/test pdfs/named_dest.pdf");nil
# pdf.save '05_1_check_named_dest_links.pdf' # never ends... :-(
pdf = CombinePDF.load "./Ruby/test pdfs/outline_small.pdf"
pdf << CombinePDF.load("./Ruby/test pdfs/outline_small.pdf")
pdf.save '06_check_links_to_second_copy.pdf'
lists = %w{./Ruby/test\ pdfs/outlines/big_toc.pdf ./Ruby/test\ pdfs/outlines/bigger_toc.pdf ./Ruby/test\ pdfs/outlines/named_dest_no_toc.pdf ./Ruby/test\ pdfs/outlines/named_dest_no_toc2.pdf ./Ruby/test\ pdfs/outlines/named_dest.pdf ./Ruby/test\ pdfs/outlines/named_dest2.pdf};
i = 0
lists.each{|n| CombinePDF.load(n).save("07_#{(i+=1).to_s}_#{n.split('/')[-1]}"); (CombinePDF.load(n) << CombinePDF.load(n)).save("07_#{(i).to_s}x2_#{n.split('/')[-1]}") }
pdf = CombinePDF.new
lists.each{|n| pdf << CombinePDF.load(n) }
pdf.save("07_named destinations.pdf")
# unify = [
# "./Ruby/test\ pdfs/AESv2\ encrypted.pdf",
# "./Ruby/test\ pdfs/data-in-comment.pdf",
# "./Ruby/test\ pdfs/file_name.pdf",
# "./Ruby/test\ pdfs/garbage_after_eof.pdf",
# "./Ruby/test\ pdfs/Many\ comments.pdf",
# "./Ruby/test\ pdfs/nested\ contents\ array.PDF",
# "./Ruby/test\ pdfs/nested_resources.pdf",
# "./Ruby/test\ pdfs/original-missing-endobje.pdf",
# "./Ruby/test\ pdfs/original-multi-issue.pdf",
# "./Ruby/test\ pdfs/page_stap_nil_secure.pdf",
# "./Ruby/test\ pdfs/referenced\ decryption.pdf",
# '',
# '',
# '',
# '',
# '',
# '',
# ''
# ]
# require 'irb'
# IRB.start