-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
110 lines (79 loc) · 2.72 KB
/
README.Rmd
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r, echo = FALSE, include=FALSE}
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
collapse = TRUE,
comment = "##"
)
```
[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/pdfbox.svg?branch=master)](https://travis-ci.org/hrbrmstr/pdfbox)
[![Coverage Status](https://codecov.io/gh/hrbrmstr/pdfbox/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/pdfbox)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/pdfbox)](https://cran.r-project.org/package=pdfbox)
# pdfbox
Create, Maniuplate and Extract Data from PDF Files (R Apache PDFBox wrapper)
## Description
I came across this thread (<https://twitter.com/derekwillis/status/922138080043241473>)
and it looks like some misguided folks are going to help promote the use of PDF
documents as a legit way to dissemiante data, which means that we're likely to
see more evil orgs and Government agencies try to use PDFs to hide data.
PDFs are barely useful as publication holders these days let alone data sources.
Apache [PDFBox](https://pdfbox.apache.org/index.html) is a project that provides
a comprehensive suite of tools to do things with and to PDF documents.
The aim here is to fill in any gaps in [`pdftools`](https://github.com/ropensci/pdftools)
since `poppler` may not try to accommodate all the stupidity that we're now likley to see.
## What's Inside The Tin
- The ability to extract URI annotations
The following functions are implemented:
- `extract_uris`: Extract URI annotations from a PDF document
- `extract_text`: Extract text from a PDF document
- `pdf_info`: Retrieve PDF Metadata
## Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/pdfboxjars")
devtools::install_github("hrbrmstr/pdfbox")
```
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```
## Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(pdfbox)
# current verison
packageVersion("pdfbox")
```
### PDF Info
```{r}
pdf_info(
system.file(
"extdata", "imperfect-forward-secrecy-ccs15.pdf", package="pdfbox"
)
) -> info
dplyr::glimpse(info)
```
### Extract URI Annotations
```{r message=FALSE, warning=FALSE, error=FALSE}
extract_uris(
system.file("extdata","imperfect-forward-secrecy-ccs15.pdf", package="pdfbox")
)
```
### Extract text
```{r}
extract_text(
system.file(
"extdata", "imperfect-forward-secrecy-ccs15.pdf", package="pdfbox"
)
) -> pg_df
dplyr::glimpse(pg_df)
```
### pdfbox Metrics
```{r echo=FALSE}
cloc::cloc_pkg_md()
```
## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.