LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.61k stars 597 forks source link

Requesting support for Gradient Color Fill and Stroke #1141

Closed HemaSudha1498 closed 7 months ago

HemaSudha1498 commented 7 months ago

I would like to request a feature for implementing gradient colors for background and stroke effects for lines and rectangles. If this functionality already exists in the current build, could you please provide me with sample code to achieve this?

Expected: gradientBg

asturio commented 7 months ago

I'm not sure if there is already such a functionality. Any idea, how this could be implemented? A possibility should be using SVG to create the images you want, and setting that as background.

mkl-public commented 7 months ago

I think nothing much changed in regard to creating shadings between iText 2.1.7 and iText 5.x (except package names), so please try something along the lines of this stack overflow answer or this one.

asturio commented 7 months ago

This seems to be much simpler than I thought. @HemaSudha1498 , please give a try on what @mkl-public mentioned, and tell us, if you had success.

asturio commented 7 months ago

Just added @mkl-public example in pdf-toolbox.

HemaSudha1498 commented 7 months ago

Its working perfectly, thanks thank you @mkl-public @asturio