Home » Eclipse Projects » BIRT » Dynamic SVG Image: Item is not supported
| Dynamic SVG Image: Item is not supported [message #720979] |
Wed, 31 August 2011 11:54  |
|
Originally posted by: Mirko Swillus
Hej,
I'm trying to render a SVG image that is provided as a byte array within
a DataSource, target format is PDF. All the PDF says, is
"Current report item is not supported in this report format."
When I put a JPG as a byte array into the DataSources property
'row["Image"]' (see rptdesign below) everything works fine. Furthermore,
adding an embedded SVG image works, too.
I guess I have to specify the images mime type ("image/svg+xml"), image
type or file extension, but I have no glue how to do it. All I tried
concerning this failed.
Please find the interesting part of my .rptdesign below. Thanks in advance,
Mirko Swillus
===========================================
<body>
<image name="name_blue" id="15">
<property name="height">3.15625in</property>
<property name="width">7.583333333333333in</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">Image</property>
<expression name="expression"
type="javascript">dataSetRow["Image"]</expression>
<property name="dataType">javaObject</property>
</structure>
</list-property>
<structure name="toc"/>
<property name="source">expr</property>
<expression name="valueExpr">row["Image"]</expression>
</image>
</body>
============================================
|
|
|
| Re: Dynamic SVG Image: Item is not supported [message #721115 is a reply to message #720979] |
Wed, 31 August 2011 18:28   |
Jason Weathersby Messages: 9167 Registered: July 2009 |
Senior Member |

|
|
Have you set the data type to blob and tried it?
I was able to read one from a file in the image onCreate script like:
importPackage(Packages.java.io);
importPackage(Packages.java.lang);
var file = new File("C:/work/workspaces/2.6.1workspaces/BIRT -
Reports/BIRT Reports/resources/spain.svg");
var ist = new FileInputStream(file);
var lengthi = file.length();
bytesa = new ByteArrayOutputStream( lengthi);
var c;
while((c=ist.read()) != -1){
bytesa.write(c);
} ist.close();
this.data = bytesa.toByteArray();
Jason
On 8/31/2011 11:54 AM, Mirko Swillus wrote:
> Hej,
>
> I'm trying to render a SVG image that is provided as a byte array within
> a DataSource, target format is PDF. All the PDF says, is
>
> "Current report item is not supported in this report format."
>
> When I put a JPG as a byte array into the DataSources property
> 'row["Image"]' (see rptdesign below) everything works fine. Furthermore,
> adding an embedded SVG image works, too.
>
> I guess I have to specify the images mime type ("image/svg+xml"), image
> type or file extension, but I have no glue how to do it. All I tried
> concerning this failed.
>
> Please find the interesting part of my .rptdesign below. Thanks in advance,
>
> Mirko Swillus
>
> ===========================================
> <body>
> <image name="name_blue" id="15">
> <property name="height">3.15625in</property>
> <property name="width">7.583333333333333in</property>
> <property name="dataSet">Data Set</property>
>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">Image</property>
> <expression name="expression"
> type="javascript">dataSetRow["Image"]</expression>
> <property name="dataType">javaObject</property>
> </structure>
> </list-property>
> <structure name="toc"/>
> <property name="source">expr</property>
> <expression name="valueExpr">row["Image"]</expression>
> </image>
> </body>
> ============================================
>
>
>
>
Jason Weathersby
BIRT Exchange
|
|
|
| Re: Dynamic SVG Image: Item is not supported [message #721269 is a reply to message #721115] |
Thu, 01 September 2011 05:50   |
|
Originally posted by: Mirko Swillus
Jason,
Am 01.09.2011 00:28, schrieb Jason Weathersby:
> Have you set the data type to blob and tried it?
thanks for your answer, but changing 'javaObject' to 'blob' makes no
difference.
But I managed to solve the problem, with the help of [0]. As I guessed
yesterday, I had to set the MIME type explicitly, since BIRT obviously
has problems to resolve the image type itself when overhanding a SVG as
a byte array (at least within my BIRT 3.7 runtime here, providing a JPG
the same way works fine).
The resulting part of my .rptdesign looks like this now:
==========================================
<body>
<image name="some" id="15">
<property name="height">3.15625in</property>
<property name="width">7.583333333333333in</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">Image</property>
<expression name="expression"
type="javascript">dataSetRow["Image"]</expression>
<property name="dataType">javaObject</property>
</structure>
</list-property>
<structure name="toc"/>
<property name="source">expr</property>
<expression name="valueExpr">row["Image"]</expression>
<expression name="typeExpr">"image/svg+xml"</expression>
</image>
</body>
===========================================
Mind the <expression name="typeExpr">"image/svg+xml"</expression>.
Quotes are required because it has to be a valid JavaScript Expression.
Regards,
Mirko Swillus
[0]
http://www.eclipse.org/birt/ref/rom/elements/Image.html#Property-typeExpr
Am 01.09.2011 00:28, schrieb Jason Weathersby:
> Have you set the data type to blob and tried it?
>
> I was able to read one from a file in the image onCreate script like:
> importPackage(Packages.java.io);
> importPackage(Packages.java.lang);
>
>
>
> var file = new File("C:/work/workspaces/2.6.1workspaces/BIRT -
> Reports/BIRT Reports/resources/spain.svg");
> var ist = new FileInputStream(file);
> var lengthi = file.length();
>
> bytesa = new ByteArrayOutputStream( lengthi);
> var c;
> while((c=ist.read()) != -1){
> bytesa.write(c);
> } ist.close();
>
> this.data = bytesa.toByteArray();
>
>
> Jason
>
> On 8/31/2011 11:54 AM, Mirko Swillus wrote:
>> Hej,
>>
>> I'm trying to render a SVG image that is provided as a byte array within
>> a DataSource, target format is PDF. All the PDF says, is
>>
>> "Current report item is not supported in this report format."
>>
>> When I put a JPG as a byte array into the DataSources property
>> 'row["Image"]' (see rptdesign below) everything works fine. Furthermore,
>> adding an embedded SVG image works, too.
>>
>> I guess I have to specify the images mime type ("image/svg+xml"), image
>> type or file extension, but I have no glue how to do it. All I tried
>> concerning this failed.
>>
>> Please find the interesting part of my .rptdesign below. Thanks in
>> advance,
>>
>> Mirko Swillus
>>
>> ===========================================
>> <body>
>> <image name="name_blue" id="15">
>> <property name="height">3.15625in</property>
>> <property name="width">7.583333333333333in</property>
>> <property name="dataSet">Data Set</property>
>>
>> <list-property name="boundDataColumns">
>> <structure>
>> <property name="name">Image</property>
>> <expression name="expression"
>> type="javascript">dataSetRow["Image"]</expression>
>> <property name="dataType">javaObject</property>
>> </structure>
>> </list-property>
>> <structure name="toc"/>
>> <property name="source">expr</property>
>> <expression name="valueExpr">row["Image"]</expression>
>> </image>
>> </body>
>> ============================================
>>
>>
>>
>>
>
|
|
|
| Re: Dynamic SVG Image: Item is not supported [message #721387 is a reply to message #721269] |
Thu, 01 September 2011 12:01   |
Jason Weathersby Messages: 9167 Registered: July 2009 |
Senior Member |

|
|
Thanks for posting.
Jason
On 9/1/2011 5:50 AM, Mirko Swillus wrote:
> Jason,
> Am 01.09.2011 00:28, schrieb Jason Weathersby:
> > Have you set the data type to blob and tried it?
>
> thanks for your answer, but changing 'javaObject' to 'blob' makes no
> difference.
>
> But I managed to solve the problem, with the help of [0]. As I guessed
> yesterday, I had to set the MIME type explicitly, since BIRT obviously
> has problems to resolve the image type itself when overhanding a SVG as
> a byte array (at least within my BIRT 3.7 runtime here, providing a JPG
> the same way works fine).
>
> The resulting part of my .rptdesign looks like this now:
>
> ==========================================
> <body>
> <image name="some" id="15">
> <property name="height">3.15625in</property>
> <property name="width">7.583333333333333in</property>
> <property name="dataSet">Data Set</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">Image</property>
> <expression name="expression"
> type="javascript">dataSetRow["Image"]</expression>
> <property name="dataType">javaObject</property>
> </structure>
> </list-property>
> <structure name="toc"/>
> <property name="source">expr</property>
> <expression name="valueExpr">row["Image"]</expression>
> <expression name="typeExpr">"image/svg+xml"</expression>
> </image>
> </body>
> ===========================================
>
> Mind the <expression name="typeExpr">"image/svg+xml"</expression>.
> Quotes are required because it has to be a valid JavaScript Expression.
>
> Regards,
> Mirko Swillus
>
>
> [0]
> http://www.eclipse.org/birt/ref/rom/elements/Image.html#Property-typeExpr
>
> Am 01.09.2011 00:28, schrieb Jason Weathersby:
> > Have you set the data type to blob and tried it?
> >
> > I was able to read one from a file in the image onCreate script like:
> > importPackage(Packages.java.io);
> > importPackage(Packages.java.lang);
> >
> >
> >
> > var file = new File("C:/work/workspaces/2.6.1workspaces/BIRT -
> > Reports/BIRT Reports/resources/spain.svg");
> > var ist = new FileInputStream(file);
> > var lengthi = file.length();
> >
> > bytesa = new ByteArrayOutputStream( lengthi);
> > var c;
> > while((c=ist.read()) != -1){
> > bytesa.write(c);
> > } ist.close();
> >
> > this.data = bytesa.toByteArray();
> >
> >
> > Jason
> >
> > On 8/31/2011 11:54 AM, Mirko Swillus wrote:
> >> Hej,
> >>
> >> I'm trying to render a SVG image that is provided as a byte array
> within
> >> a DataSource, target format is PDF. All the PDF says, is
> >>
> >> "Current report item is not supported in this report format."
> >>
> >> When I put a JPG as a byte array into the DataSources property
> >> 'row["Image"]' (see rptdesign below) everything works fine.
> Furthermore,
> >> adding an embedded SVG image works, too.
> >>
> >> I guess I have to specify the images mime type ("image/svg+xml"), image
> >> type or file extension, but I have no glue how to do it. All I tried
> >> concerning this failed.
> >>
> >> Please find the interesting part of my .rptdesign below. Thanks in
> >> advance,
> >>
> >> Mirko Swillus
> >>
> >> ===========================================
> >> <body>
> >> <image name="name_blue" id="15">
> >> <property name="height">3.15625in</property>
> >> <property name="width">7.583333333333333in</property>
> >> <property name="dataSet">Data Set</property>
> >>
> >> <list-property name="boundDataColumns">
> >> <structure>
> >> <property name="name">Image</property>
> >> <expression name="expression"
> >> type="javascript">dataSetRow["Image"]</expression>
> >> <property name="dataType">javaObject</property>
> >> </structure>
> >> </list-property>
> >> <structure name="toc"/>
> >> <property name="source">expr</property>
> >> <expression name="valueExpr">row["Image"]</expression>
> >> </image>
> >> </body>
> >> ============================================
> >>
> >>
> >>
> >>
> >
>
Jason Weathersby
BIRT Exchange
|
|
| | | | | | | | | | | | | | | | |
Goto Forum:
Current Time: Fri May 24 10:11:35 EDT 2013
Powered by FUDForum. Page generated in 0.02989 seconds
|