SCM

SCM Repository

[rqda] View of /pkg/RQDA/R/pdf.R
ViewVC logotype

View of /pkg/RQDA/R/pdf.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 491 - (download) (annotate)
Wed Dec 12 07:05:18 2012 UTC (6 years, 2 months ago) by wincent
File size: 1253 byte(s)
rename an argument in pdfXMP, add Rd files; RQDA 0.2-3 rc
importPDFHL <- function(file, type=c("Highlight"), engine="rjpod"){
    if (missing(file)) {
        file <- gfile(text="select a pdf file", type="open", filter=list("PDF"=list(patterns=c("*.PDF"))))
    }
    fileName <- basename(file)
    fileName <- enc(fileName)
    maxid <- RQDAQuery("select max(id) from source")[[1]]
    nextid <- ifelse(is.na(maxid),0+1, maxid+1)
    write <- FALSE
    if (nextid==1) {
        write <- TRUE
    } else {
        if (nrow(RQDAQuery(sprintf("select name from source where name='%s'", fileName)))==0) {
            write <- TRUE
        } else {
            gmessage("A file withe the same name exists in the database!")
        }
    }
    if (write ) {
        if (engine == "rjpod") {
            ans <- rjpod:::pdfAnnotations(file, type = type)
            finfo <-  rjpod:::pdfXMP(file, jabrefOnly=TRUE)
            finfo <- gsub("^bibtex/","", finfo)
            finfo <- paste(sort(finfo), collapse=",\n")
        }
        RQDAQuery(sprintf("insert into source (name, file, id, status,date,owner, memo )
                             values ('%s', '%s',%i, %i, '%s', '%s', '%s')",
                          fileName,enc(ans), nextid, 1, date(), .rqda$owner, enc(finfo)))
        FileNamesUpdate()
    }
}

R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge