pdf_links_checker 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +13 -14
- data/Rakefile +1 -5
- data/exe/pdf_links_checker +1 -8
- data/lib/pdf_links_checker.rb +1 -0
- data/lib/pdf_links_checker/pdf_document.rb +8 -0
- data/lib/pdf_links_checker/url.rb +1 -0
- data/lib/pdf_links_checker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce8e50b31b32e8b7fc0a62dc7b3b3fc8818e54e1e86aef62394f303338e9be03
|
|
4
|
+
data.tar.gz: ceb5be089c2c35581b6f32106212be5abb19893ab7ac08416b9ac66953320136
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff2ff91b47790616b9dea5e2c2af1731ce7a146055bba6c44330583b0fb0c5b61136dae8ec454ec492f870d2a8217b486fb54609a24bcc1b3cc7b805756d509c
|
|
7
|
+
data.tar.gz: cb911c257a974dbcf383e1f68542a280b70ff7467739354035e2d1b6c5713a54d09d4183197a3ce7f946191d94caf49e6924fc9869c34a4e1c5fd2cc045349ad
|
data/README.md
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PDF Links Checker
|
|
2
2
|
|
|
3
3
|
[](https://travis-ci.org/AndyWendt/pdf_links_checker)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A utility to ensure that links in PDFs are reachable
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
$ gem install pdf_links_checker
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
gem 'pdf_links_checker'
|
|
13
|
-
```
|
|
11
|
+
## Usage
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
Commandline:
|
|
16
14
|
|
|
17
|
-
$
|
|
15
|
+
$ pdf_links_checker path/to/file.pdf`
|
|
16
|
+
Working links: 1 of 2
|
|
17
|
+
https://not-a-chance-that-this-is-a-working-link.com/
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Code:
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
file_name = "foo.pdf"
|
|
22
|
+
file_path = "#{Dir.pwd}/#{file_name}"
|
|
23
|
+
links = PdfLinksChecker::PdfDocument.from(file_path).links
|
|
24
24
|
|
|
25
|
-
TODO: Write usage instructions here
|
|
26
25
|
|
|
27
26
|
## Development
|
|
28
27
|
|
|
@@ -32,7 +31,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
32
31
|
|
|
33
32
|
## Contributing
|
|
34
33
|
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andywendt/pdf_links_checker.
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
## License
|
data/Rakefile
CHANGED
data/exe/pdf_links_checker
CHANGED
|
@@ -3,16 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
require "pdf_links_checker"
|
|
5
5
|
require "pdf_links_checker/pdf_document"
|
|
6
|
-
require "pdf-reader"
|
|
7
|
-
require "net/http"
|
|
8
6
|
|
|
9
7
|
file_name = ARGV[0]
|
|
10
8
|
file_path = "#{Dir.pwd}/#{file_name}"
|
|
11
|
-
|
|
12
|
-
path = File.expand_path(file_path)
|
|
13
|
-
doc = PDF::Reader.new(path)
|
|
14
|
-
|
|
15
|
-
links = PdfLinksChecker::PdfDocument.new(doc).links
|
|
16
|
-
|
|
9
|
+
links = PdfLinksChecker::PdfDocument.from(file_path).links
|
|
17
10
|
puts "Working links: #{links.valid_count} of #{links.total_count}"
|
|
18
11
|
links.invalid.each { |invalid_link| puts invalid_link }
|
data/lib/pdf_links_checker.rb
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
require "pdf_links_checker/annotations"
|
|
2
2
|
require "pdf_links_checker/links"
|
|
3
3
|
require "pdf_links_checker/page"
|
|
4
|
+
require "pdf-reader"
|
|
4
5
|
|
|
5
6
|
module PdfLinksChecker
|
|
6
7
|
class PdfDocument
|
|
8
|
+
def self.from(file_path)
|
|
9
|
+
path = File.expand_path(file_path)
|
|
10
|
+
doc = PDF::Reader.new(path)
|
|
11
|
+
|
|
12
|
+
self.new(doc)
|
|
13
|
+
end
|
|
14
|
+
|
|
7
15
|
def initialize(pdf_doc)
|
|
8
16
|
@pdf_doc = pdf_doc
|
|
9
17
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pdf_links_checker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andy Wendt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-12-
|
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Ensures links in PDFs are accessible
|
|
14
14
|
email:
|