• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

writing pdf directly to Firebasestorage

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys.... I am back... with more code:

The problem:

I want to upload a PDF that I create directly to Firebasedatabase without storing it on the phone...

All the tutorials I have worked through needs an URI to fetch the file from... and I don't know where that is...

The document is created by android like this:



The question is : where is this file stored to??? I need that URI...

to upload the file this is what I have written:


Is there anyone that can give me some idea how to solve this please........... something.... anything???

Thanks
Ben
 
Ranch Hand
Posts: 385
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How you create the pdf file? How you know the pdf file is done created? Maybe you can store pdf file locally, then get the path and send to firebase ?  
 
Ben van Jaarsveld
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

If is test the application and store it locally I can view it... so I know it is created...

The idea of the app is to not give thee user access to the file, except from firebase..

Is there a way i can store it temporarily and upload then delete it?
 
Randy Tong
Ranch Hand
Posts: 385
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the pdf file done created, what the user will do next? Will it has a submit button for user to submit to firebase?
 
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about creating your PDF document in memory as an OutputStream and writing the byte[] directly to your firebase database. The following example does not write anything to the file system:

 
Ben van Jaarsveld
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No .. I am creating a leave document for an employee... so the user gives dates... type of leave ....then sign on the screen...

then I want the pdf created with all information and uploaded to Firebase...

 
Ben van Jaarsveld
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Cooke wrote:What about creating your PDF document in memory as an OutputStream and writing the byte[] directly to your firebase database. The following example does not write anything to the file system:




I wasn't sure how to do that....

a question: how easy is it then to download from firebase and display the file then???
 
Tim Cooke
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Retrieving from firebase is easy as there's a getBytes() method.

How easy it is to display on an Android device is a question for someone more Android savvy than me.
 
Tim Cooke
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps even a new question for a new thread "How to display a PDF on an Android device that's stored as a byte array?"
 
Ben van Jaarsveld
Ranch Hand
Posts: 48
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was using a library ...com.github.barteksc.pdfviewer.PDFView which can....

perfect

thanks for all the help guys!!!
 
Tim Cooke
Marshal
Posts: 4662
301
IntelliJ IDE Clojure Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks promising:

https://github.com/barteksc/AndroidPdfViewer wrote:All available options with default values:
...
pdfView.fromBytes(byte[])
...

 
He baked a muffin that stole my car! And this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!