mmaceachran
mmaceachran

Reputation: 3338

Flying Saucer PDF not showing color

I have an html that is converted into a PDF with FlyingSaucer that is not displaying any color. the HTML is simple:

<div class="pdfLabel">Label Information</div>

and the css is:

 .pdfLabel {
text-align:center;
background:#033c73;
color:#FFF; 
padding-top:4px; 
padding-bottom:4px;
padding-left: 5px;
padding-right: 5px;
width: 98%;
font-weight:bold;
font-size: 15pt;
border-radius: 15px;    
 }

what's weird is that some of styles work, the text-align, padding, font-weight, font-size all work just fine, but my world is in back and white. :(

any ideas?

EDIT:

here is the code that produces the PDF:

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
        ITextRenderer renderer = new ITextRenderer();
        renderer.setDocumentFromString(viewHtml);
        renderer.layout();
        renderer.createPDF(os);
    } finally {
        try {os.close();} catch (Exception eClose) {}
    }

the viewHtml is the string mentioned above.

Upvotes: 0

Views: 1495

Answers (1)

alexanbj
alexanbj

Reputation: 76

I had the same problem. We are using Bootstrap in our application, and it turns out that it was Bootstrap's print css that caused this for us. Colors in the PDFs worked when we removed those styles.

Upvotes: 4

Related Questions