Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change height or width of pdf in react (npm react-pdf) [closed]

Change the loaded pdf layout (height and width) in react-pdf.

This includes :

  1. Load pdf in reactjs
  2. Modify height and width of pdf.
like image 449
Rahul Sarma Avatar asked Jan 25 '23 17:01

Rahul Sarma


1 Answers

First if you want to load a pdf in reactjs, you can refer this article https://levelup.gitconnected.com/displaying-pdf-in-react-app-6e9d1fffa1a9

And you can also clone https://github.com/wojtekmaj/react-pdf

After that, add some css to position it to center and define your own height and width of the document

.react-pdf__Page__canvas {
    margin: 0 auto;
    width: 80% !important;
    height: 100% !important;
}

And you are good to go.

like image 190
Rahul Sarma Avatar answered Jan 30 '23 11:01

Rahul Sarma