2

I am using iText library to convert the HTML files into PDF. I want a table to have rounded corners. Following is the CSS that I am using.

table {
    border-spacing: 0;
}
th, td {
    border: 1px solid #000;
    padding: 0.5em 1em;
}
/* the first 'th' within the first 'tr' of the 'thead': */
tr:first-child td:first-child {
    border-radius: 0.6em 0.6em 0 0;
}
/* the last 'th' within the first 'tr' of the 'thead': */
tr:first-child td:last-child {
    border-radius: 0.6em 0.6em 0 0;
}
/* the first 'td' within the last 'tr' of the 'tbody': */
tr:last-child td:first-child {
    border-radius: 0.6em 0.6em 0 0;
}
/* the last 'td' within the last 'tr' of the 'tbody': */
tr:last-child td:last-child {
    border-radius: 0 0 0.6em 0.6em;
}

I am able to see the rounded corners in the browser. However, when I generate PDF, the rounded corners are not present. Any help would be appreciated.

Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102
  • 2
    That's not supported when converting HTML to PDF. Rounded borders are implemented using cell events (and those aren't created by HTMLworker nor by XML Worker). – Bruno Lowagie Feb 19 '14 at 15:13
  • @BrunoLowagie Thanks for the response. I did it by setting the image with rounded corners in table background. However, I have another difficulty in which I would like to have your inputs. I have an image stored as byte array in database. Now, I want to render this image in the pdf file (i.e. in an HTML file which is converted in pdf using iText library). I would appreciate your thoughts. – Darshan Mehta Feb 24 '14 at 07:21
  • @DarshanMehta The itext library does not support it, like said before. But I tried this and worked: https://stackoverflow.com/a/44877568/3294286 But, it is really a big pain to change your CSS to make that work. I finally decided to change the render to https://github.com/danfickle/openhtmltopdf which worked perfectly – Sebastian D'Agostino Jul 19 '19 at 18:38

0 Answers0