• Stars
    star
    254
  • Rank 160,264 (Top 4 %)
  • Language
    Java
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PDF Toolkit. πŸ“Ž πŸ”¨ πŸ”§ βœ‚οΈ πŸ“‘ πŸ“πŸ“Ž πŸ”– 🚧 πŸ‘·

staplr

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Licence Build Status


CRAN_Status_Badge


Last-changedate

staplr

This package provides functions to manipulate PDF files:

  • fill out PDF forms: get_fields() and set_fields()
  • merge multiple PDF files into one: staple_pdf()
  • remove selected pages from a file: remove_pages()
  • rename multiple files in a directory: rename_files()
  • rotate entire pdf document: rotate_pdf()
  • rotate selected pages of a pdf file: rotate_pages()
  • Select pages from a file: select_pages()
  • splits single input PDF document into individual pages: split_pdf()
  • splits single input PDF document into parts from given points: split_from()

This package is still under development and this repository contains a development version of the R package staplr.

Installation

staplr requires a Java installation on your system. You can get the latest version of java from here. OpenJDK also works.

You can install the stable version from CRAN.

install.packages('staplr', dependencies = TRUE)

You can install staplr from github with:

# install.packages("devtools")
devtools::install_github("pridiltal/staplr")

Example

library(staplr)
# Merge multiple PDF files into one
staple_pdf()

# This command prompts the user to select the file interactively. 
# Remove page 2 and 3 from the selected file.
remove_pages(rmpages = c(2,3))

# This function selects pages from a file;
select_pages(selpages = c(1,3))

# This function splits a single input PDF document into individual pages
split_pdf()

# This function writes renamed files back to directory
#if the directory contains 3 PDF files
rename_files(new_names = paste("file",1:3))

# These functions are to fill out pdf forms
get_fields() 
set_fields()
# This includes 2 external functions `get_fields` and `set_fields` 
# and files to use as examples.
# This is what the example file looks like

# If you get path to this file by
pdfFile = system.file('testForm.pdf',package = 'staplr')

# And do
fields = get_fields(pdfFile)
# You'll get a list of fields that the pdf contains 
# along with some additional information about the fields.

# You make modifications in any of the fields by
fields$TextField1$value = 'this is text'
set_fields(pdfFile, 'newFile.pdf', fields)

# This will create a filled pdf file

Troubleshooting and 2.11.0 changes

  • As of version 2.11.0, the package uses pdftk-java instead of using the original pdftk. pdftk-java is included with the package so if you have a working java installation, you shouldn’t have any problems.

  • While default java options should be enough for most use cases, if you need to, you can change java options that is used to run pdftk by doing

options('staplr_java_options' = '-Xmx512m') 

This option is not affected by rJava settings.

  • If you don’t have a working java installation, your installation will fail since you can’t install rJava. Make sure you follow the proper instructions for java installation. For openJDK on linux make sure you get both jdk and jre and run javareconf.
sudo apt update -y
sudo apt install -y openjdk-8-jdk openjdk-8-jre
sudo R CMD javareconf

Also restart your R session after javareconf

  • pdftk-java is built as a faithful representation of the original pdftk so there shouldn’t be any major differences between the outputs. However, for any reason you’d prefer to run a local installation of pdftk rather than using the version that is shipped with the package, do
# set staplr_custom_pdftk to the path to local installation
# just setting to pdftk will do if it's already in your path
 options('staplr_custom_pdftk' = 'pdftk') 

If you want to do this, you can get the original version of pdftk from here. Note that MacOS users with a version higher than β€œHigh Sierra” should use this version instead.

Make sure to set the option back to NULL if you want to use the built in pdftk later.

References

More Repositories

1

ctv-AnomalyDetection

CRAN Task View: Anomaly Detection with R πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›’πŸ›οΈπŸ›’πŸ›’
R
110
star
2

oddstream

oddstream {Outlier Detection in Data STREAMs} 🐟 🐟 🐟 🐟 🐠 🐟 🐟 🐟 🐟 🐟 🐟 🐟 🐟 🐟🐟
R
62
star
3

stray

stray {Search and TRace AnomalY}. Full paper is available from https://arxiv.org/pdf/1908.04000.pdf 🐢🐢🐢🐢🐱 🐢 🐢🐢🐢🐢
R
57
star
4

oddwater

A feature-based procedure for detecting technical outliers in water-quality data from in situ sensors πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦β˜”πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦πŸ’¦
R
9
star
5

outfit

outfit (OUTlier Detection in multivariate FunctIonal DaTa) ⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏲️⏰⏰⏰⏰⏰⏰⏰⏰⏰⏰⏱️
R
3
star
6

stray_manuscript

TeX
2
star
7

datahut

R
1
star
8

PythonTaskView-Statistics

1
star
9

outstable

R
1
star
10

clap

clap: Detecting Class Overlapping Regions in Multidimensional Data πŸ‘πŸ‘πŸ‘
R
1
star
11

CM1110-Materials

1
star
12

COVID_ScholarSL

This repository contains a list of useful projects and resources related to COVID-19 🦠 in Sri Lanka. 🦠🦠🦠🦠🦠
1
star
13

PhD_Thesis_2019

TeX
1
star
14

mask

R
1
star
15

MonashEBS_xaringan

JavaScript
1
star
16

R4FUN

TeX
1
star
17

oddstream_manuscript

TeX
1
star
18

CM2110_notes

HTML
1
star
19

CM1110

https://pridiltal.github.io/CM1110/
HTML
1
star
20

Outlier-Detection-Review-Papers

1
star
21

IambilingualPR

I am Bilingual - Python and R
HTML
1
star
22

oddwater_manuscript

TeX
1
star