react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

White line on the bottom of the rendered PDF

Open jperestrelo opened this issue 5 years ago โ€ข 4 comments

Describe the bug

Not sure if its a bug... Iยดm trying to use an image as a background and It showing a white line on the bottom of the rendered pdf. Can't find a way to remove it, I have tried, many different page sizes and image sizes, the result is always the same.

here is a printscreen

If its not a bug, can you help somehow?

Thanks,

jperestrelo avatar Jun 03 '21 16:06 jperestrelo

Can you provide a small snippet replicating this? I can't tell from just an image. Thanks!

diegomura avatar Jun 05 '21 22:06 diegomura

Hi @diegomura ,

I can isolate the code just to this, and you will be able to replicate the issue:

` import React from 'react'; import { Page, Image, Document } from '@react-pdf/renderer'; import Background from '../../assets/images/diploma_background.png'

export const diploma = () => {

return (
    < Document >
        <Page size="A4" orientation="landscape">
            <Image src={Background} />
        </Page>
    </Document >
)

} `

I also attach the background image diploma_background

jperestrelo avatar Jun 06 '21 09:06 jperestrelo

You need to set the image width and height to 100%. You can also use objectFit: "cover" or similar so it adjust to the container

diegomura avatar Jun 06 '21 18:06 diegomura

thanks @diegomura , setting the width and height to 100% solved it. And thanks for the library, it works really nice and its really easy to use ๐Ÿ‘ ๐Ÿ™

jperestrelo avatar Jun 08 '21 14:06 jperestrelo