Question

I am creating dynamic jasper reports. Things are looking fine. How do I add a dynamic header image to the generated reports?

I am using

FastReportBuilder fr = new FastReportBuilder();
Style headerStyle = new Style();
headerStyle.setBackgroundColor(Color.BLUE);
headerStyle.setPadding(5);

fr.setTitle("Title")
    .setSubtitle("Sub title")
    .setPrintBackgroundOnOddRows(true)
    .setUseFullPageWidth(true)
    .setPageSizeAndOrientation(Page.Page_A4_Landscape())
    .setTitleHeight(100)
    .setTitleStyle(headerStyle);

But its not working. Reports will be exported in pdf, csv, and html formats.

Was it helpful?

Solution

It works for me

fr.setUseFullPageWidth(true)
        .setPageSizeAndOrientation(Page.Page_A4_Landscape())
        .addFirstPageImageBanner("path/logo_strip.jpg", 800, 50, ImageBanner.ALIGN_LEFT);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top