Title: | Read Portable Document Format (PDF) Files |
---|---|
Description: | Provides an interface to 'PDFMiner' <https://github.com/pdfminer/pdfminer.six> a 'Python' package for extracting information from 'PDF'-files. 'PDFMiner' has the goal to get all information available in a 'PDF'-file, position of the characters, font type, font size and informations about lines. Which makes it the perfect starting point for extracting tables from 'PDF'-files. More information can be found in the package 'README'-file. |
Authors: | Florian Schwendinger [aut, cre, cph], Benjamin Schwendinger [aut, cph] |
Maintainer: | Florian Schwendinger <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0 |
Built: | 2024-12-07 06:30:06 UTC |
Source: | CRAN |
The function
is_pdfminer_installed( method = c("csv", "sqlite", "PythonInR"), pyexe = "python3" )
is_pdfminer_installed( method = c("csv", "sqlite", "PythonInR"), pyexe = "python3" )
method |
a character string giving the data transfer method. Allowed values
are |
pyexe |
a character string giving the path to the python executable
(default is |
Returns TRUE
if pdfminer is installed.
is_pdfminer_installed()
is_pdfminer_installed()
PDF
document.Extract PDF
document
layout_control( line_overlap = 0.5, char_margin = 2, line_margin = 0.5, word_margin = 0.1, boxes_flow = 0.5, detect_vertical = FALSE, all_texts = FALSE )
layout_control( line_overlap = 0.5, char_margin = 2, line_margin = 0.5, word_margin = 0.1, boxes_flow = 0.5, detect_vertical = FALSE, all_texts = FALSE )
line_overlap |
a double, if two characters have more overlap than this they are considered to be on the same line. The overlap is specified relative to the minimum height of both characters. |
char_margin |
a double, if two characters are closer together than this margin they are considered part of the same line. The margin is specified relative to the width of the character. |
line_margin |
a double, if two characters on the same line are further apart than this margin then they are considered to be two separate words, and an intermediate space will be added for readability. The margin is specified relative to the width of the character. |
word_margin |
a double, if two lines are are close together they are considered to be part of the same paragraph. The margin is specified relative to the height of a line. |
boxes_flow |
a double, Specifies how much a horizontal and vertical
position of a text matters when determining the order of text boxes.
The value should be within the range of |
detect_vertical |
a logical, If vertical text should be considered during layout analysis |
all_texts |
a logical, If layout analysis should be performed on text in figures. |
Returns a list with the layout control variables.
layout_control()
layout_control()
PDF
document.Extract PDF
document
read.pdf( file, pages = integer(), method = c("csv", "sqlite", "PythonInR"), laycntrl = layout_control(), encoding = "utf8", password = "", caching = TRUE, maxpages = Inf, rotation = 0L, image_dir = "", pyexe = "python3" )
read.pdf( file, pages = integer(), method = c("csv", "sqlite", "PythonInR"), laycntrl = layout_control(), encoding = "utf8", password = "", caching = TRUE, maxpages = Inf, rotation = 0L, image_dir = "", pyexe = "python3" )
file |
a character string giving the name of the |
pages |
an integer giving the pages which should be extracted
(default is |
method |
a character string giving the data transfer method. Allowed values
are |
laycntrl |
a list of layout options, created by the function |
encoding |
a character string giving the encoding of the output
(default is |
password |
a character string giving the password necessary to access
the |
caching |
a logical if |
maxpages |
an integer giving the maximum number of pages to be extracted
(default is |
rotation |
an integer giving the rotation of the page, allowed values
are |
image_dir |
a character string giving the path to the folder, where the images
should be stored (default is |
pyexe |
a character string giving the path to the python executable
(default is |
Returns a object of class "pdf_document"
.
if (is_pdfminer_installed()) { pdf_file <- system.file("pdfs/cars.pdf", package = "pdfminer") read.pdf(pdf_file) }
if (is_pdfminer_installed()) { pdf_file <- system.file("pdfs/cars.pdf", package = "pdfminer") read.pdf(pdf_file) }