Skip to content

Commit

Permalink
add xbar example
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Sep 12, 2024
1 parent 1ed0728 commit 040295a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ directory before trying to install the package. This can be changed from
write permission by choosing "Run as administrator" when launching R (again,
from the right-click context menu).

## Debugging

Load the package like this:

```r
devtools::load_all()
libname = "/home/pacha/R/x86_64-pc-linux-gnu-library/4.4"
pkgname = "tabulapdf"
rJava::.jpackage(pkgname, jars = "*", lib.loc = libname)
rJava::J("java.lang.System")$setProperty("java.awt.headless", "true")
```

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/tabulapdf/issues).
Expand Down
26 changes: 26 additions & 0 deletions dev/test-special_characters.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
devtools::load_all()
libname <- "/home/pacha/R/x86_64-pc-linux-gnu-library/4.4"
pkgname <- "tabulapdf"
rJava::.jpackage(pkgname, jars = "*", lib.loc = libname)
rJava::J("java.lang.System")$setProperty("java.awt.headless", "true")

file <- "inst/examples/xbar.pdf"
pages <- NULL
area <- NULL
password <- NULL
encoding <- NULL
copy <- FALSE

pdfDocument <- load_doc(file, password = password, copy = copy)
on.exit(pdfDocument$close())

stripper <- new(J("org.apache.pdfbox.text.PDFTextStripper"))

if (is.null(stripper)) {
stop("Failed to initialize PDFTextStripper.")
}

stripper$setSortByPosition(TRUE)
stripper$setAddMoreFormatting(TRUE)

out <- stripper$getText(pdfDocument)
Binary file added inst/examples/xbar.pdf
Binary file not shown.

0 comments on commit 040295a

Please sign in to comment.