on 05-21-2010 5:35 AM
Dear all,
I have 2 issues in exporting PDF in RAS 12.1.0.882/ CR 2008 [designer]
1) I want to get the Total No of pages before exporing a report to PDF
2) I want to use this number to be displayed on top like page 1 of N format
The reason I am not using TotalPageCount is performance issue. For only certain customers, we want to enable this on PDF export.
[Note if I use TotalPageCount in a conditional manner, still report goes for an extra pass]
To avoid this and enable page total based on demand, I created a parameter 'totalpages' [hidden param] in that report
For 1) Still I have to figure out getLastPage() or so to find the total pages.
For 2) I modified the parameter and set it back in Viewer, it does nt work.
Please help to programatically set parameter to be reflected in PDF export
// Setting Parameter Snippet
if (paramName.equals("pagetotal")) {
ParameterField newPf = (ParameterField) srcField.clone(true);
Values pvls = new Values();
ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
String val = "11"; //Dummy value as Total Page
pfdv.setValue(val);
pfdv.setDescription("pagetotal");
pvls.add(pfdv);
newPf.setCurrentValues(pvls);
newPf.setReportName(srcField.getReportName())
}
// Viewer Snippet
ReportExportControl expViewer = new ReportExportControl();
expViewer.setReportSource( csb.getRcd().getReportSource());
if (csb.getNewFields() != null) //if there are parameters
{
expViewer.setParameterFields(csb.getNewFields());
//expViewer.setEnableParameterPrompt(false); - tried not working
//expViewer.setReuseParameterValuesOnRefresh(true); - tried not working
//expViewer.refresh(); - tried not working
expViewer.setOwnPage(false);
}
ExportOptions expOpt = new ExportOptions();
expOpt.setExportFormatType(expFormat); // In this case PDF
expViewer.setExportOptions(expOpt);
expViewer.setExportAsAttachment(true);
expViewer.processHttpRequest(request,response,servletContext,null);
Thanks,
Sumathi
I cannot use any 3rd party solutions
Please help me how to set a parameter programtically before EXPORT to PDF
Any other solution of finding TotalNoOfPages in crystal reports other than the special field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
At least one of the 3rd-party Crystal report Desktop Scheduling tools listed at: http://www.kenhamady.com/bookmarks.html
allows you to automate the process of exporting a Crystal report to PDF and then adding page numbers (including Page N of M format).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.