Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Base64 encoded background image missing in PDF
Base64 encoded background image missing in PDF [message #1228997] Wed, 08 January 2014 14:06 Go to next message
Zeb Ford-Reitz is currently offline Zeb Ford-ReitzFriend
Messages: 33
Registered: November 2010
Member
I need to dynamically assign a background image for a report that I'm currently working on. I accomplish this by grabbing the image from the database, converting it to base64, and assigning it to a pre-defined style in a beforeFactory script (similar to the example script at from http://developer.actuate.com/community/devshare/_/designing-birt-reports/1542-data-engine-api-to-check-data-set-values/). This method works for HTML output, but not for PDF output (the image is simply missing)...and I'm not sure why. Does anyone know of a way to set a dynamically set a background image such that it's present in an emitted PDF?

This is the only way that I've found so far to dynamically assign a background image, so I'm certainly open to other methods.

I'm using Eclipse Business Intelligence and Reporting Tools SDK (Build id: v20130611-1045).

Thanks a lot!

- Zeb
Re: Base64 encoded background image missing in PDF [message #1245888 is a reply to message #1228997] Fri, 14 February 2014 12:05 Go to previous message
Günter Plattner is currently offline Günter PlattnerFriend
Messages: 1
Registered: February 2014
Junior Member
I have a quiet similar problem rendering a base64 image in PDF output. The behavior is, that the image will be rendered fine in HTML output, but not in PDF output (just the alt-text is rendered).

My environments: Birt 4.2.0, 4.3.1.

Example design file:

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.23" id="1">
    <property name="createdBy">Eclipse BIRT Designer Version 4.3.1.v201309091055 Build &lt;4.3.1.v20130917-1035></property>
    <property name="units">in</property>
    <property name="iconFile">/templates/blank_report.gif</property>
    <property name="bidiLayoutOrientation">ltr</property>
    <property name="imageDPI">96</property>
    <parameters>
        <scalar-parameter name="qrCodeUri" id="8">
            <text-property name="promptText">qrCodeUri</text-property>
            <property name="valueType">static</property>
            <property name="dataType">string</property>
            <property name="distinct">true</property>
            <simple-property-list name="defaultValue">
                <value type="constant">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADUAAAA1AQAAAADJnZ7dAAABaklEQVR42mP4DwY/GHDRH4SaH093qGD4fnlx1b/7FQxfImXijl0E0kECcfMCgXRMDYsBkP5+W6+QGyj/QTQ0NBSo/v+HvoL9QP1f+uWYJKIqGD5rXhE/nf2D4d+807eX7ahg+Gs4b9V0rQqGT1IS72fX/2D4lJ+RY9/2g+H3KV/bWOUfDH+WevyLL/jB8MMpye1iPJBvJfl87TKge+4JmHbP+sHwdbNukVX4D4ZvDJ/ZfRkqGP6VpBUdKwXaG/wn8GBIBcPXwiXF7kVA9czFrC9YgOaker19ZQ+Ub97GO7MSyH9zNd3B4wfD9xjjjC0Hge7a32mkYQR0p6Dvza6EHwwf1zW/VDUD8pn5ptVXA8OjcJ1w+0wg7XdSbOP0CqB59quedgHt99zPdJIdKP7hV8HiclB4XQ/jDweGx/XrZYeB7vkSVc7WwASkQ2aIKWgD6VCTrqIMoL33A0PTrwPDS+jvj8qJuMMfSgMASRDqGcFdMjAAAAAASUVORK5CYII=</value>
            </simple-property-list>
            <list-property name="selectionList"/>
            <property name="paramType">simple</property>
            <property name="controlType">text-box</property>
            <structure name="format">
                <property name="category">Unformatted</property>
            </structure>
        </scalar-parameter>
    </parameters>
    <styles>
        <style name="report" id="4">
            <property name="fontFamily">sans-serif</property>
            <property name="fontSize">10pt</property>
        </style>
        <style name="crosstab-cell" id="5">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
        <style name="crosstab" id="6">
            <property name="borderBottomColor">#CCCCCC</property>
            <property name="borderBottomStyle">solid</property>
            <property name="borderBottomWidth">1pt</property>
            <property name="borderLeftColor">#CCCCCC</property>
            <property name="borderLeftStyle">solid</property>
            <property name="borderLeftWidth">1pt</property>
            <property name="borderRightColor">#CCCCCC</property>
            <property name="borderRightStyle">solid</property>
            <property name="borderRightWidth">1pt</property>
            <property name="borderTopColor">#CCCCCC</property>
            <property name="borderTopStyle">solid</property>
            <property name="borderTopWidth">1pt</property>
        </style>
    </styles>
    <page-setup>
        <simple-master-page name="Simple MasterPage" id="2">
            <page-footer>
                <text id="3">
                    <property name="contentType">html</property>
                    <text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
                </text>
            </page-footer>
        </simple-master-page>
    </page-setup>
    <body>
        <text id="7">
            <property name="contentType">html</property>
            <text-property name="content"><![CDATA[<IMG src='<VALUE-OF>params["qrCodeUri"]</VALUE-OF>' alt='QR-Code'>]]></text-property>
        </text>
    </body>
</report>
Previous Topic:Event not fired with dynamic table
Next Topic:How to use STYLE in HTML element? It not work
Goto Forum:
  


Current Time: Thu Apr 25 06:50:31 GMT 2024

Powered by FUDForum. Page generated in 0.02325 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top