Giter Club home page Giter Club logo

Comments (12)

leeper avatar leeper commented on May 27, 2024

Okay, I assume the issue is something to do with how tabulizer runs the file through localize_file(). Do you know what your shiny app gives as the value of inFile$datapath?

from tabulapdf.

Aeilert avatar Aeilert commented on May 27, 2024

I see.

inFile$datapath gives a temporary folder of the form "/var/folders/v4/gmb8wwgx1jj_94hdm2rc4bjh0000gn/T//RtmpYGRbyk/ced0c48b4af993d4d1ca7da4/0". Interestingly this path seem to change when a new file is uploaded. The other values (name, size) in the input$file1 / inFile - dataframe are also updated, but the output displayed is not.

I have also tried different uses of reactive and reactiveValues-statements to force a resetting of the cache, but have not succeeded so far.

And cudos for the swift reply.

from tabulapdf.

Aeilert avatar Aeilert commented on May 27, 2024

Do you have any suggestions or workarounds to this problem?

If the app only needs to function RStudio you could use the base R-command file.choose instead of fileInput. But I'm interested in a browser-app.

from tabulapdf.

PirateGrunt avatar PirateGrunt commented on May 27, 2024

I experience the same issue. When uploading a file, Shiny will write it to subdirectory below a temporary directory. load_doc will call localize_file with copy = TRUE, which will make a copy of the uploaded file. In later calls, this file never seems to get replaced.

I cloned the repo and ran with some edits locally. If I change the copy parameter in load_doc from TRUE to FALSE (line 23 of utils.R), everything works as expected.

I'd submit a pull request, but I'm not 100% clear on the mechanism which produces the error, nor the purpose of COPY in localize_file.

from tabulapdf.

PirateGrunt avatar PirateGrunt commented on May 27, 2024

A bit more on this. I think the more significant issue is with regard to line 13 in utils.R. The default behavior for file.copy is NOT to overwrite the file if it already exists. The way that Shiny uploads files is such that they will always exist in a subfolder of tempdir() and will have a basename of "0" or some such. localize_file will take its source and copy it to tempdir(). On the second call, there is already a file with a name like "0.pdf" at that location. Because we're not passing in overwrite = TRUE, the copy never takes place. This is a very easy change, that I've tested for my specific use case. I'll go ahead and submit a pull request.

from tabulapdf.

 avatar commented on May 27, 2024

While using extract_areas in a shiny app, it is giving an Error: Can't call runApp() from within runApp(). If your application code contains runApp(), please remove it.
I understand, extract_areas is built as a shiny based functionality but I want to upload PDFs using shing InputFile and id pages to locate areas and extract.
Is there simple way to get the same?
Thanks in advance

from tabulapdf.

leeper avatar leeper commented on May 27, 2024

@abhivedula You can't use extract_areas() in a shiny app because it is a shiny app. If you want to use the underlying functionality, pass input to extract_tables().

from tabulapdf.

 avatar commented on May 27, 2024

Thanks for the reply Leeper. I have an additional question. Can we develop a customized version extract_areas as shiny app to host online ?

from tabulapdf.

leeper avatar leeper commented on May 27, 2024

You're more than welcome to. This package is licensed MIT, so as long as you comply with that you should be good to go.

from tabulapdf.

 avatar commented on May 27, 2024

Sorry to bother you. One last question on this topic. I am developing a shiny app to host in shinyapps.io. It should have a file upload feature and once we upload PDF, it should give option to select areas for extract tables just like the extract_areas feature which does that in viewer.
I am relatively new to R so please bear with my ignorance.

from tabulapdf.

leeper avatar leeper commented on May 27, 2024

I am not a shiny expert so I really can't provide any assistance with that.

from tabulapdf.

 avatar commented on May 27, 2024

Thanks a lot leeper. Btw tabulizer is awesome :)

from tabulapdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.