I have found below in their site documentation. How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How do I download a pdf file onClick with react-pdf? Ask Question. Asked 3 years, 3 months ago. Active 11 months ago. Viewed 24k times. I think the example you have in your question is for server side rendering a PDF with Node.
I think it does not have api to download your pdf. We recommend using React from npm with a bundler like browserify or webpack. You can use the react and react-dom packages. After installing it using npm install --save react react-dom , you can use:. Note: by default, React will be in development mode.
What PDF should be displayed. Its value can be an URL, a file imported using import String: "Please wait! String: "Please select a file. Function called when an outline item has been clicked.
Usually, you would like to use this callback to move the user wherever they requested to. Function called in case of an error while retrieving document source from file prop.
An object in which additional parameters to be passed to PDF. For a full list of possible parameters, check PDF. Rendering mode of the document. Can be "canvas" , "svg" or "none". Rotation of the document in degrees. If provided, will change rotation globally, even for the pages which were given rotate prop of their own.
Canvas background color. Any valid canvas. If you set renderMode to "svg" this prop will be ignored. Page height. If neither height nor width are defined, page will be rendered at the size defined in PDF.
If you define width and height at the same time, height will be ignored. If you define height and scale at the same time, the height will be multiplied by a given factor. String: "Please select a page. Which page from PDF file should be displayed, by page number. If provided, pageIndex prop will be ignored.
Whether interactive forms should be rendered. Rotation of the page in degrees.
0コメント