jcatubay
-
Posts
14 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Downloads
Posts posted by jcatubay
-
-
Hi! How do you format the date for a barcode? I'm trying to use date for my barcode. I want it to have the hour, min and sec but when I use the date in the barcode it givec me everything like the MDT FRI and stuffs I dont need. I only need mm/dd/yy, hour, min and sec.
-
I'm trying to format my date when I use it in barcode.
I want to print '101 10/05/2007 1' in barcode. I use this barcode expression ("101 "+$P{inputdate}+" 1"). My problem is how can I format the date when I print the barcode instead of '101 10/05/2007 1' I have
'101 Thu May 10 12:37:47 MDT 2007 1'. How can I change the format?
-
My subreport is working well when I generate the report using iReport. In iReport I use ".\SubReport.jasper" as my subreport expression class. But when I use it in my application it generates an error that it cant find the file ".SubReport.jasper". I'm using absolute path in my application, "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/appsname/WEB-INF/reports/MainReport.jrxml" for the main.
I tried using absolute path in iReport using "C:\Program Files\apache Software Foundation\Tomcat 5.5\webapps\appsname\WEB-INF\reports\SubReport.jasper". I does not generate an error but it will not show my subreport. I'm using Spring so I'm guessing since I use absolute path I cant use ".\Subreport.jasper". How come my subreport is not showing in my main report when I use absolute path in iReport? I pointed to that file when I added my subreport on subreport wizard.
-
I have a report that has a subreport. I'm new to using subreports. How can I fill my subreport then use it in my main report then display the reports as pdf. When I used single report, I just generate a resultset then convert it to JRDataSource then use sendToResponse in my JSF. Do I have to generate JRDataSource first for my subreport? How do I connect the two reports in my application?
-
Here it is..
public void sendToPDF(byte[] bytes){
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType("application/pdf");
response.addHeader("Content-Disposition","attachment;filename=Report.pdf");
sendToResponse(response, bytes);
}
private void sendToResponse(HttpServletResponse response, byte[] bytes){
ServletOutputStream servletOutputStream = null;
try {
servletOutputStream = response.getOutputStream();
response.setContentLength(bytes.length);
servletOutputStream.write(bytes, 0, bytes.length);
servletOutputStream.flush();
servletOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
FacesContext.getCurrentInstance().responseComplete();
}
-
Thanks a lot, this works! One more question. Is there a way that I dont have to refresh the page before I can click any buttons or links?
-
Hi! I have a pdf report that opens when I click a button in my page. But it's not convenient to click back then refresh again if I want to navigate out of the report and continue to navigate throught the page where my button was. Is there a way that I can just open a new browser to display my pdf without navigating away from the page where I click to open the report.
Thanks!
-
Thanks a lot!
-
Thanks, that helps!
-
I dont like to have queries in my code but I still want to be able to fill me report using the reports query. Would JREmptyDataSource give empty report. The program right now is using the parameters, my program generates a resultset by executing the queries in my program, then make that into a JRDataSource. After getting the JRDataSource, together with jrxml file, I pass them to a method that generates my byte[].This is the method:
public byte[] generatePDFReport(File reportFile, Map parameters, JRDataSource ds) {
byte[] bytes = null;
try {
JasperReport jasperReport = JasperCompileManager.compileReport(reportFile.getPath());
bytes = JasperRunManager.runReportToPdf(
jasperReport,
parameters,
ds);
} catch (JRException e) {
e.printStackTrace();
}
return bytes;
}
After I get the bytes, I pass it to another method:
public void sendToPDFResponse(byte[] bytes){
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType("application/pdf");
sendToResponse(response, bytes);
}
to publish it in the web.
What I want to do now is bypass the method where I get my JRDataSource using my programs query. I want to find a way to just use the query in my xml to get my data and generate byte[]. I saw a method in my JasperManager that have this interface:
bytes = JasperRunManager.runReportToPdf(
jasperReport,
parameters);
return bytes;
So it uses just the parameters and jasperreport but when I use it it generates just a null byte[].What are the precondition for me to be able to use this method and generate my data?
Thanks a lot for helping with this, I'm new to JasperReport but I think it's cool and I want to learn more about it....
-
How did you generate your byte array? Did you have a query in your application to get the data? That is what I'm doing right now, I create a JRDatasource in my application the fill it report with the data. I'm currently using:
bytes = JasperRunManager.runReportToPdf(
JasperReport jasperReport,
Map parameters,
JRDatasource ds
)
But I want to get away with queries in my code and just use the queries stored in my reports. I want to do something like this
bytes = JasperRunManager.runReportToPdf(
JasperReport jasperReport,
Map parameters);
But for some reason it returns a null value for my bytes.
Thanks!
-
I saw this function in my jasperRunManager.class:
public static byte[] runReportToPdf(net.sf.jasperreports.engine.JasperReport jasperReport, java.util.Map map)
what are the preconditions for this method to be used?
-
I'm using
JasperReport jasperReport = JasperCompileManager.compileReport(reportFile.getPath());
bytes = JasperRunManager.runReportToPdf(
jasperReport,
parameters);
return bytes;
for some reason it returns a null value. What are the conditions so I can use this version of the runReportToPdf. I'm using hibernate and spring
Thanks!
Date Format in Barcode
in Products
Posted