Skip to main content
Skip table of contents

pdfHTML: Support for linearGradient in CSS and SVG

Introduction

In pdfHTML 3.0.1 (as well as iText Core release 7.1.12) came support for the linearGradient attribute within SVG input as well as with CSS styling. In a related article we demonstrated how to use this functionality within the iText 7 Core layout engine, while here we shows how it works when using pdfHTML.

Below are two quick examples which demonstrate this functionality.



CSS Example:

Link to HTML input for this PDF: linearGradient.html

Link to resultant PDF: CSSOutput.pdf

##GITHUB:https://github.com/calreynoldsitext/linearGradientSVGCSS/blob/master/basicHTMLPDF.java##

##GITHUB:https://github.com/calreynoldsitext/linearGradientSVGCSS/blob/master/CSStoPDF.cs##


This code yields the following resultant PDF (screenshot):



SVG Example:

Link to SVG input for this PDF: linearGradient.SVG

Link to resultant PDF: SVGOutput.pdf

##GITHUB:https://github.com/calreynoldsitext/linearGradientSVGCSS/blob/master/SVGtoPDF.java##

##GITHUB:https://github.com/calreynoldsitext/linearGradientSVGCSS/blob/master/linearGradientSVG.cs##


This code yields the following resultant PDF (screenshot):



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.