diff --git a/README.Rmd b/README.Rmd index d94771b..b2e457d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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). diff --git a/dev/test-special_characters.R b/dev/test-special_characters.R new file mode 100644 index 0000000..59cdb34 --- /dev/null +++ b/dev/test-special_characters.R @@ -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) diff --git a/inst/examples/xbar.pdf b/inst/examples/xbar.pdf new file mode 100644 index 0000000..7c8ff46 Binary files /dev/null and b/inst/examples/xbar.pdf differ