Print and print preview with embedded html elements [message #631066] |
Wed, 06 October 2010 01:58  |
Eclipse User |
|
|
|
Hi,
I'm using BIRT report designer 2.6 and corresponding birt-viewer. In one of my report grid columns I have dynamic text html iframe tag requesting a web page through src-tag. Designer preview in Eclipse and birt-viewer under Tomcat show the embedded page correctly in html format, but print-preview shows only part (upper) of the report page (and also prints accordingly). If I use pdf format the embedded element disappears totally.
I've heard that the viewer does not support pdf format in this case, but it seems not even html. Any clue to the problem from someone?
regards
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Print and print preview with embedded html elements [message #631758 is a reply to message #631579] |
Fri, 08 October 2010 11:38  |
Eclipse User |
|
|
|
That blog entry is very good. I am attaching an example of google maps
that does not use an iframe but you do have to modify the viewer
framesetfragment.jsp. See the report for notes.
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21"
id="1">
<property name="comments">In order to use this report, please
obtain a Google Maps API Key. Then place this key in the Header Code
Item at the top of the report. This report was tested in Internet
Explorer v6.
When you run the report, click on any row in the Customer Data table.
That will display the Google map and create a marker for the city in
which the customer is located.
Please refer to Google Maps API for documentation on utilizing their
API.</property>
<property name="createdBy">Eclipse BIRT Designer Version
2.5.2.v20100208 Build <2.5.2.v20100210-0630></property>
<text-property name="title">Google Maps Mashup in a BIRT
Report</text-property>
<property name="units">in</property>
<property name="layoutPreference">auto layout</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="CMI" id="119">
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Customers" id="120">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">ADDRESSLINE1</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CITY</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STATE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">POSTALCODE</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">CMI</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">CUSTOMERNAME</property>
<property name="nativeName">CUSTOMERNAME</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">ADDRESSLINE1</property>
<property name="nativeName">ADDRESSLINE1</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">CITY</property>
<property name="nativeName">CITY</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">STATE</property>
<property name="nativeName">STATE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">POSTALCODE</property>
<property name="nativeName">POSTALCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select
CLASSICMODELS.CUSTOMERS.CUSTOMERNAME,
CLASSICMODELS.CUSTOMERS.ADDRESSLINE1,
CLASSICMODELS.CUSTOMERS.CITY,
CLASSICMODELS.CUSTOMERS.STATE,
CLASSICMODELS.CUSTOMERS.POSTALCODE
from CLASSICMODELS.CUSTOMERS
where
CLASSICMODELS.CUSTOMERS.COUNTRY = 'USA'
order by CLASSICMODELS.CUSTOMERS.STATE]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="table-group-header-1" id="106">
<property name="backgroundColor">#0B285B</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">medium</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-group-footer-1" id="107">
<property name="backgroundColor">#0B285B</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">medium</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-group-header-2" id="108">
<property name="backgroundColor">#13449B</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-group-footer-2" id="109">
<property name="backgroundColor">#13449B</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-group-header-3" id="110">
<property name="backgroundColor">#1A5FDA</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-group-footer-3" id="111">
<property name="backgroundColor">#1A5FDA</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#FFF8DC</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#FFF8DC</property>
<property name="borderRightColor">#FFF8DC</property>
<property name="borderTopColor">#FFF8DC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-header" id="112">
<property name="backgroundColor">#6495ED</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#483D8B</property>
<property name="borderBottomStyle">double</property>
<property name="borderLeftColor">#483D8B</property>
<property name="borderRightColor">#483D8B</property>
<property name="borderTopColor">#483D8B</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thin</property>
<property name="textAlign">right</property>
</style>
<style name="table-footer" id="114">
<property name="backgroundColor">#6495ED</property>
<property name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFE0</property>
<property name="borderBottomColor">#483D8B</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">thin</property>
<property name="borderLeftColor">#483D8B</property>
<property name="borderRightColor">#483D8B</property>
<property name="borderTopColor">#483D8B</property>
<property name="borderTopStyle">double</property>
<property name="textAlign">right</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<property name="topMargin">1in</property>
<property name="leftMargin">1.25in</property>
<property name="bottomMargin">1in</property>
<property name="rightMargin">1.25in</property>
<page-footer>
<text id="3">
<property name="style">table-group-footer-3</property>
<property name="fontSize">xx-small</property>
<property name="fontStyle">italic</property>
<property name="textAlign">left</property>
<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>
<label name="Header Label" id="68">
<property name="backgroundColor">#0000FF</property>
<property name="fontSize">xx-large</property>
<property name="fontWeight">bold</property>
<property name="color">#FFFFFF</property>
<property name="textAlign">center</property>
<text-property name="text">BIRT Report Integrating Google
Maps</text-property>
</label>
<text name="Header Code Item" id="66">
<property name="borderBottomColor">#0000FF</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">thick</property>
<property name="borderLeftColor">#0000FF</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">thick</property>
<property name="borderRightColor">#0000FF</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">thick</property>
<property name="borderTopColor">#0000FF</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">thick</property>
<property name="paddingTop">1pt</property>
<property name="textAlign">center</property>
<property name="contentType">html</property>
<text-property name="content"><![CDATA[
<script type="text/javascript">
var geocoder = null;
var map = null;
function load(newaddress,mapname)
{ // Create new map object once
if (!map)
{
if (!mapname)
{
alert ("No mapname");
return;
}
map = new GMap2(document.getElementById(mapname));
if (!map)
{
alert ("Could not create Google map");
return;
}
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
// Create new geocoding object once
if (!geocoder)
{
geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("US");
}
// Retrieve location information, pass it to addToMap()
geocoder.getLocations(newaddress, addToMap);
}
// This function adds the point to the map
function addToMap(response)
{
// Retrieve the object
var place = response.Placemark[0];
// Retrieve the latitude and longitude
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
// Center the map on this point
map.setCenter(point, 3);
// Create a marker
marker = new GMarker(point);
GEvent.addListener (marker, "click", function() {
marker.openInfoWindowHtml (place.address);
}
);
// Add the marker to map
map.addOverlay(marker);
// Add address information to marker
marker.openInfoWindowHtml(place.address);
}
</script>
<div id="map1" style="width: 100%; height:
300px"><BR><BR><BR><BR><BR><BR> <B>(Click on a ROW below to see a map of
the address)</B></div>
]]></text-property>
</text>
<table name="Customer Data" id="71">
<property name="width">100%</property>
<property name="dataSet">Customers</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">CUSTOMERNAME</property>
<expression
name="expression">dataSetRow["CUSTOMERNAME"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">ADDRESSLINE1</property>
<expression
name="expression">dataSetRow["ADDRESSLINE1"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">CITY</property>
<expression
name="expression">dataSetRow["CITY"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">STATE</property>
<expression
name="expression">dataSetRow["STATE"]</expression>
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">POSTALCODE</property>
<expression
name="expression">dataSetRow["POSTALCODE"]</expression>
<property name="dataType">string</property>
</structure>
</list-property>
<property name="pageBreakInterval">50</property>
<column id="100"/>
<column id="101"/>
<column id="102"/>
<column id="103"/>
<column id="104"/>
<header>
<row id="72">
<cell id="73">
<label id="74">
<property name="textAlign">center</property>
<text-property name="text">Name</text-property>
</label>
</cell>
<cell id="75">
<label id="76">
<property name="textAlign">center</property>
<text-property
name="text">Address</text-property>
</label>
</cell>
<cell id="77">
<label id="78">
<property name="textAlign">center</property>
<text-property name="text">City</text-property>
</label>
</cell>
<cell id="79">
<label id="80">
<property name="textAlign">center</property>
<text-property
name="text">State</text-property>
</label>
</cell>
<cell id="81">
<label id="82">
<property name="textAlign">center</property>
<text-property name="text">ZIP</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="83">
<cell id="84">
<property name="textAlign">center</property>
<text id="118">
<property
name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<table width=100%>
<tr>
<td style="cursor:hand" onMouseOver="this.bgColor = '#CCFFFF'"
onMouseOut="this.bgColor = '#FFFFFF'"
onclick="load('<VALUE-OF>row["CITY"]</VALUE-OF>, USA','map1');">
<VALUE-OF>row["CUSTOMERNAME"]</VALUE-OF>
</td>
</tr>
</table>]]></text-property>
</text>
</cell>
<cell id="86">
<property name="textAlign">center</property>
<text id="117">
<property
name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<table width=100%>
<tr>
<td style="cursor:hand" onMouseOver="this.bgColor = '#CCFFFF'"
onMouseOut="this.bgColor = '#FFFFFF'"
onclick="load('<VALUE-OF>row["CITY"]</VALUE-OF>,
USA','map1');"><VALUE-OF>row["ADDRESSLINE1"]</VALUE-OF>
</td>
</tr>
</table>]]></text-property>
</text>
</cell>
<cell id="88">
<property name="textAlign">center</property>
<text id="116">
<property
name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<table width=100%>
<tr>
<td style="cursor:hand" onMouseOver="this.bgColor = '#CCFFFF'"
onMouseOut="this.bgColor = '#FFFFFF'"
onclick="load('<VALUE-OF>row["CITY"]</VALUE-OF>,
USA','map1');"><VALUE-OF>row["CITY"]</VALUE-OF>
</td>
</tr>
</table>]]></text-property>
</text>
</cell>
<cell id="90">
<property name="textAlign">center</property>
<text id="115">
<property
name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<table width=100%>
<tr>
<td style="cursor:hand" onMouseOver="this.bgColor = '#CCFFFF'"
onMouseOut="this.bgColor = '#FFFFFF'"
onclick="load('<value-of>row["CITY"]</value-of>,
USA','map1');"><VALUE-OF>row["STATE"]</VALUE-OF>
</td>
</tr>
</table>]]></text-property>
</text>
</cell>
<cell id="92">
<property name="textAlign">center</property>
<text id="105">
<property
name="fontFamily">sans-serif</property>
<property name="fontSize">x-small</property>
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<table width=100%>
<tr>
<td style="cursor:hand" onMouseOver="this.bgColor = '#CCFFFF'"
onMouseOut="this.bgColor = '#FFFFFF'"
onclick="load('<VALUE-OF>row["CITY"]</VALUE-OF>,
USA','map1');"><VALUE-OF>row["POSTALCODE"]</VALUE-OF>
</td>
</tr>
</table>]]></text-property>
</text>
</cell>
</row>
</detail>
<footer>
<row id="94">
<cell id="95"/>
<cell id="96"/>
<cell id="97"/>
<cell id="98"/>
<cell id="99"/>
</row>
</footer>
</table>
<text id="121">
<property name="contentType">auto</property>
<text-property name="content"><![CDATA[Put the below in the
framesetfragment.jsp located in the viewer plugin
\birt\webcontent\birt\pages\layout directory]]></text-property>
</text>
<label id="122">
<text-property name="text"> <script
src="http://maps.google.com/maps?file=api& ;amp;v=2&amp;sensor=false&amp;key=ABQIAAAAzr 2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94Q xWIa6N4U6MouMmBA "
type="text/javascript"></script></text-property>
</label>
</body>
</report>
On 10/8/2010 1:12 AM, auvo.finne@jyu.fi wrote:
> Thanks Jason! I think we can close this issue now. The error I mentioned
> seems to be related to my Firefox, because in IE the prints from
> birt-viewer work. I'll try to develop the image format rendering from
> the web map server. Another option is to let my java controller simply
> to write out the the html page and let the BIRT then capture it through
> an iframe-tag in the text element. I found also some interesting ideas
> in "Evgeny's Blog: BIRT Best Practice". He presents how to integrate
> Google Maps into BIRT.
>
> Auvo
|
|
|
Powered by
FUDForum. Page generated in 0.05820 seconds