Malformed image while exporting to PDF from JasperReports Server - jasper-reports

I have an image that is embedded in my report. Locally (via JasperReports Studio) everything works fine. I can export image in any format to any output format and everything is in order.
However, when I deploy my report on JRS (with image) I'm getting something like this
, when image is in bmp format.
When I convert image to png or jpg and then I deploy it on the JRS I am getting the following error:
ERROR EngineServiceImpl,pool-5-thread-179:598 - Error while exporting report to PDF
net.sf.jasperreports.engine.JRException: java.io.IOException: The byte array
is not a recognized imageformat.
Any clues?
EDIT:
I use JasperStudio, here's the configuration of img element:
<image>
<reportElement x="200" y="50" width="120" height="111" uuid="03e9bde6-8ddd-4b0e-b3c7-8d44b4d71ff9"/>
<imageExpression><![CDATA["Images/hidden_logo.png"]]></imageExpression>
</image>

Related

get a dynamic image in jasperserver

I am trying to call a dynamic image in jasperserver 8.0.0, the problem is that it is working for jasperstudio 6.19 but when I upload it to the server it shows me an error (The error message is to contact the administrator :D)
<image>
<reportElement key="image-1" x="11" y="2" width="76" height="51" uuid="51d3ca8b- d083-4e86-9249-8fc9f7dbb1fa"/>
<imageExpression><![CDATA[$P{DIR} + $F{COD_EMPRESA}.toString()]]></imageExpression>
</image>
COD_EMPRESA returns a number for example 10, and that 10 is the image.
I found the solution by placing the images in a folder inside the server, since I worked locally and the folder was outside the server, in the image path I put the following code and it worked (the path points to the server and also works on jasperstudio)
"/images/"+ $F{COD_EMPRESA}.toString()

processing an XSL-FO file with FOP in eXist-db exits with "permission denied" (only on Linux)

I'll start by stating the context this question is based on: I'm running eXist-4.7.1 in a Tomcat container, and am trying to specify fonts in a configuration file for a PDF transformation using FOP (eXist-4.7.1 ships with FOP version 2.3).
The good news: it seems that some progress has been made since earlier reports on font configuration on the eXist-open mailing list (https://markmail.org/message/so43jgratswpu4dz), and I'm now able to load fonts via the http:// protocol. Here is a self-contained XQuery example (which can be stored in and run from the db):
xquery version "3.1";
import module namespace xslfo="http://exist-db.org/xquery/xslfo";
let $fo :=
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="my_page" margin="0.5in">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="my_page">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="urbanist">Hello world!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
let $fop.config :=
<fop version="1.0">
<use-cache>false</use-cache>
<renderers>
<renderer mime="application/pdf">
<fonts>
<font kerning="yes" embed-url="https://github.com/coreywho/Urbanist/raw/master/fonts/static/Urbanist-Black.ttf">
<font-triplet name="urbanist" style="normal" weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
let $pdf := xslfo:render($fo, "application/pdf", (), ($fop.config))
return response:stream-binary($pdf, "application/pdf", "output.pdf")
The even better news: this is working without problems on my Windows box, where it produces a PDF document looking as follows (with the right font):
The bad news: when running the exact same XQuery example in exactly the same Tomcat setup on my Linux production server, the xslfo:render() call exits with an error:
<exception>
<path>/db/apps/test-fop-fonts/test-fop-fonts.xq</path>
<message>exerr:ERROR .fop (Permission denied) [at line 40, column 13]</message>
</exception>
Unfortunately, this is about everything that's being logged. Clearly, something is going wrong on the Linux box, but I have no clue what it could be. Apart from this glitch, eXist is operating perfectly in my Linux Tomcat, so I'm quite confident file permissions should be OK.
Has anyone else encountered this "permission denied" error?
Best,
Ron
Apparently, it turned out to be a lower-level OS problem: the problem disappeared when starting Tomcat as root user, after which eXist could happily create the PDF file.
After some more digging, it appeared that FOP caches files in home directory of the user running it, which was lacking for my non-privileged Tomcat user.... and that the problem could be fixed by just creating a home directory for this user, or providing the path to a writable folder for that user in the Tomcat startup script, e.g. -Duser.home=$CATALINA_TMPDIR!
If anyone else should bump into this, I've found the solution here: https://forum.xwiki.org/t/pdf-export-issue-with-file-permissions/4933/11. (phew!)

When I download a pdf i am getting this error net.sf.jasperreports.engine.JRException: Could not load object from location

In my local machine i can download the report successfully. When I copy the jaspers and jrxml file to my production server it is showing this error. Please suggest me.
net.sf.jasperreports.engine.JRException: Could not load object from location : D:\Ravi Workspace\Openbrm\open-brm-openbrm-2.0\resources\designs\ageing-esr-40-srpski-subreport.jasper
In My report I have defined like this and all my jasper files are in the same folder.
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["D:\\Ravi Workspace\\Openbrm\\open-brm-openbrm-2.0\\resources\\designs\\"]]></defaultValueExpression>
</parameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{invoiceInfoList})]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "ageing-esr-40-srpski-subreport.jasper"]]></subreportExpression>
The path you are using is directly linked to your hard drive. The folder structure for the server will be different.
According to this answer https://stackoverflow.com/a/3387463/5191221 there is no way to use relative paths for the subreport.
So you could either set the path to the exact server path where the subreport lies (I would avoid that at all costs).
Or you could put the subreport into the same folder like the main report and just call it directly:
<subreportExpression><![CDATA["ageing-esr-40-srpski-subreport.jasper"]]></subreportExpression>

Can I use a URL with CFZIP action=read?

When I use Coldfusion 10, locally, I can read a zip file's text file content using:
<cfzip action="read" file="http://someurl.com/somezip.zip" entrypath="sometext.txt" variable="somevar" />
But on my Railo VPS, this produces an internal server error 500 on IIS7.5
Can anyone tell me where I am going wrong with Railo?
Not sure about Railo, but according to the <cfzip> doc, ACF does not support reading off http://, only ram://. You should use <cfhttp> to download the content first.

Kentico : Unable to upload image using quick insert

I was trying to insert image on a blog post document using quick insert image in Kentico's WYSIWG editor.
But during upload process it seems to stall.
On further debug I find that the button event btnHidden_Click was not called within the usercontrol
\CMSModules\Content\Controls\Attachments\DirectFileUploader\DirectFileUploaderControl.ascx.cs.
There are some silver-light error messages as well
Line: 231
Error: Unhandled Error in Silverlight Application
Code: 2108
Category: InitializeError
Message: Failed to download the splash screen
Not sure what version of Kentico are you using but if it's version 7 or older try to add the following key into your web.config file:
<add key="CMSUseSilverlightUploader" value="false" />