pdfjs icon indicating copy to clipboard operation
pdfjs copied to clipboard

possible `border-radius` support for cell?

Open mashpie opened this issue 4 years ago • 3 comments

Hi Markus,

thanks a lot for this lib with it's Wonderfull api. It's way more focused on devs needs and real world use-cases than any other lib I had the chance to work with... good job!

Now, as per CI-Guide I had to find a way to place an image with "roundedCorners" on-top of a 2-coloured header provided by a pdf-template. Managed that by drawing those coloured corners onto the image directly. Another much more precise and flexible approach I was thinking of is to place that image within a cell and configure a border-radius (css-analogy), like so:

const img = new pdf.Image(imageBuffer)
this.doc.cell({ x: 40, y: 842 - 40, boderRadius: 10, overflow: 'hidden' }).image(img, { width: 140 })

What do you think? Would such be feasible in any way?

Example output composed by pdf-template (all green drawings) cells with text and cell with modified image:

Bildschirmfoto 2020-04-09 um 12 35 23

mashpie avatar Apr 09 '20 10:04 mashpie

Hi, thanks for the kind words! I agree that this would be a very useful feature to have! Though I am not sure about the required effort. I'll have to find some time to dig the PDF specification a bit, maybe there is a way to use some kind of a mask to apply such rounded borders to a cell.

rkusa avatar Apr 14 '20 06:04 rkusa

Hi, thanks for the kind words! I agree that this would be a very useful feature to have! Though I am not sure about the required effort. I'll have to find some time to dig the PDF specification a bit, maybe there is a way to use some kind of a mask to apply such rounded borders to a cell.

Could you please implement this? Roundness is key in modern UI, and to make my pdfs look good, I would also like to have roundness. Just look at this website... Imagine if css did not have border radius. Look at the amount of rounded objects here, I would love to have the same ability in pdfjs.

m1daz avatar Jul 28 '23 16:07 m1daz

Could you please implement this? Roundness is key in modern UI, and to make my pdfs look good, I would also like to have roundness. Just look at this website... Imagine if css did not have border radius. Look at the amount of rounded objects here, I would love to have the same ability in pdfjs.

I don't need convincing that border-radius is nice/useful to have 😄. Since my usage of pdfjs does not require border-radius, I don't expect to invest time into it anytime soon, so don't keep your hopes up.

rkusa avatar Jul 31 '23 08:07 rkusa