Any Way to generate pdf in Memory with React and post the pdf to a service? - reactjs

I have gone through posts where they are able to generate pdf and save in react.
But I don't want to save the pdf instead want to keep it in memory or send it as a stream to the service.

Related

React file upload without using node - possible?

Is it possible to have a file upload work in React only without Node? I say this because every single article I read, node is involved. All I want to do is for a user to be able to upload a picture to my react app (filling in a simple form), and when they submit that form, a new post is created along with the picture they uploaded. I don't need the post to persist, this is frontend only. Is it possible to do this without node?
You can make this to work but you will need AWS or other Image upload services like Cloudinary.
You can create an account with AWS, create a bucket and use their SDK to push the image to them and they will return a URL.
Checkout this article though: https://javascript.plainenglish.io/how-to-upload-files-to-aws-s3-in-react-591e533d615e

How can I pull remotely stored PDFs to be viewed in Ionic?

I have a site where PDFs are uploaded and stored (all exactly the same way) as (publicly available) attachments on a web page.
Using an Ionic app, I want to query the site and pull in the PDFs as a list where each item can be opened and read in the app. The PDFs would remain on the site/server, but would be available through the Ionic interface to be read as pages.
What kind of setup or services would I need for something like this?
It seems to me like you'd want an API that simply lists the available PDFs and the URL/Location for them. That would be better than the ionic app trying to parse HTML from your existing site (which is what it sounds like you're considering). Then the ionic app can call this service and get the PDF listing in JSON, which is very natural.
Then if the PDFs are externally accessible (meaning no token/security required), the display of the PDF should be a simple window.open() call.

Upload a temporary image on AngularJS

I want to simply upload an image so I have a path that links to it temporarily (not the user's local route), that way I will send that path to the backend and there it will be saved on a database. Since it is only for a few seconds until the backend saves it permanently, I want it to be deleted afterwards.
I've been trying with fileReader but so far I have no clue on how to achieve this.

How to store images in firebase using URL from cloud storage service?

Hi I am developing an ionic app using firebase as my database.
I read this question.
I understand it and have a more specific question.
I uploaded an image on amazon s3, imgur and filestack, and tried all three in firebase using data:url/<the url of image> and data:image/jpeg;<url of image>.
Am I typing something wrong into firebase?
The image does not come up. I do not want to write code in the app to upload the image etc, I just simply want an image to display on the app beside some data corresponding to an item in my firebase database.
I have read about base64, do I have to use it in this case?
(Optional) Perhaps If you could expand on the steps of doing this:
"You can use a filepicker to get the image file. Then you can host the image however you want, i prefer amazon s3. Once the image is hosted you can display the image using the url generated for the image."
I don't have much ionic experience, but why not just save the direct path to the image url and not include the data:url/ portion.
Simply store the url in firebase and then when it's retrieved inject it into your img src.

How should images be saved using express? Database, or just file?

I am using basically the mean stack. I'm also using multer but I am trying to see what the best practices are. Using Angular I can upload photos fine and they are going to a folder on my file system. From here I can just view them. However I'm wondering what the best practices are. Should I save the image url to a database along with the size and other properties or should I just pull them from the client? I've seen some solutions but they were from about 2 years ago so I wanted to make sure I'm current.
I have used ng-file-upload upload on the angular part and Multer on the node.js part to handle images for my system.
The method is appropriate and you can go ahead without any doubt.
Most of the websites on the internet follow the same method, they save the images in the file disk system and then they save it's url in the respective database.
Using multer you can have all information required for a photo and the module is really flexible with a lot many options.
I think you should go ahead with what you have in mind. Best of luck.
You just save the image url from the directory, where image is stored. If you need any information, you can get the information from the image where image is stored (Get image from url). So just save image url into database.

Resources