react-file-viewer icon indicating copy to clipboard operation
react-file-viewer copied to clipboard

Height and width issue for csv,xlsx and image

Open ncmadhan1989 opened this issue 5 years ago • 2 comments

Height and width issue for csv,xlsx and image it take 96px as default,any solution?

ncmadhan1989 avatar Mar 29 '20 08:03 ncmadhan1989

Did you fix it? Can you share your solution?

josedager avatar Jun 12 '20 05:06 josedager

Had to figure this out as well. If you want your image to scale to fit your sizing requirements, just make height=100% in the surrounding div. E.g.

<div style={{ height: '100%' }}>
   <ReactFileViewer />
</div>

If you don't want the image scaled at all, then it's a little trickier. I've had to resort to some messy CSS to override the hardwired width and height settings:

.pg-viewer-wrapper {
    overflow-y: unset !important;
}

.photo-viewer-container {
    width: unset !important;
    height: unset !important;
}

.photo-viewer-container > img {
    width: unset !important;
    height: unset !important;
}

It would be great if this component had features like scaling (e.g. fit, fill, percentage) but I don't think the library is being maintained any more (looking at the old PRs that are still waiting), so would recommend forking and implementing a cleaner solution than what I have done.

Hivemind9000 avatar Dec 03 '20 03:12 Hivemind9000