_ivanovich_
7 years agoFrequent Contributor
How to write http status code in red or green in a file?
Hi,
I'm trying to generate a pdf file for my report.
I need to display status code in green if it's 200 otherwise in red.
i tried this:
i get status from a project property
if(status == '200'){
Chunk statuscode = new Chunk ("Status is: "+status, smallBold)
status.setBackground(BaseColor.GREEN)
Paragraph p = new Paragraph(status)
}else if (status != '200'){
Chunk statuscode = new Chunk ("Status is: "+status, smallBold)
status.setBackground(BaseColor.RED)
Paragraph p = new Paragraph(status)
}else{
log.info "ERROR"
}
document.add(p)
It creates file with 0k.Cannot open it