callrmk Posted February 14, 2009 Share Posted February 14, 2009 Hi,we are using jasper to generate PDF file for a webpage.Idea is to provide a printer friendly format for a webpage. I am using 'parameters' to generate text. Page desing is like as below (lables and values are all parameters)Label1 : value1Label2: value2Label3: Value3Label4:Value4------------------Label9:value9Label10: value 10Label11:value11-------------------Our problem is that, when the end of the page is reached, the next label is not printing while scrolling down to next page.For example, After Label9:value9 if it is next page, Label10:value10 is not printing/hiding but the text after that is printinng in PDF.Is there anyway to scroll down to next page without loss of data,please advice.Please find the attachement of report design. Link to comment Share on other sites More sharing options...
callrmk Posted March 4, 2009 Author Share Posted March 4, 2009 Hi,No one knows the solution to this problem.I am still searching for a solution.greatly appreciate your help Link to comment Share on other sites More sharing options...
callrmk Posted March 26, 2009 Author Share Posted March 26, 2009 Hi,Still couldn't find solution to the problem.Is there any one ever used Jasper to generate PDF for a web page.Please help. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted March 26, 2009 Share Posted March 26, 2009 Hi, No one replied probably because no one understood your problem.Instead of attaching a screenshot of iReport, you should attach a copy of the JRXML file and also a copy of the PDF, to show the exact problem.It is not clear to me what the problem actually is. Thank you,Teodor Link to comment Share on other sites More sharing options...
callrmk Posted March 27, 2009 Author Share Posted March 27, 2009 Hi Teodor,Thanks for your reply.I am here with attaching jrxml,pdf report generated and the Java program to fill and export the report.Trying to generate PDF for a webpage(TO provide printer friendly version in PDF to avoid browser dependencies) How i am doing that?i have around 70 elements on a webpage and the height of the Detail band is not sufficient to place all elements.So I am using group header and group footer so that I can place some of our detail elements on a special group header, some of them will probably remain on the detail section, and the rest could go on the group footer.i have started placing the elemets on Group Header ,and i expected the elements to flow(isSplit=true) to the next PDF page when they are not fit in current page.But when the end of the page is reached, subsequent elements are disappearing.In the PDF report i have attached,last line of the first page isName of regulatory authority of manager Rugulatroy Authority ValueThe next line to be printed as a first line of the next page is Please provide the licence number issued L1212122212121 by the relevant regulatory authority but this line is disappearing and the next line to be printed also missing some of its part.Please see the PDF and java programs attached.I have tried with isPrintWhenDetailOverflows but couldn't work.Depending on the data entered by the user for each field,last line of the page may differ but what expected is, It should flow to next page if it not fits in current page.Please advice whethere there is any other way or am i doing anything wrong.kindly ask me if you need more clarification about my problem.Thank you,Regards,Mohan Code:public class CreatePDF {public static void main(String[] args){try{String srcFileName = "D:\JasperReport\newdesign\NotificationForm.jrxml";String destFilename="D:\JasperReport\fromsvn\NotificationformPDFReport.jasper";JasperCompileManager.compileReportToFile(srcFileName,destFilename);//fill parametersparameters.put("page_title", "View Notification");parameters.put("notificationNo_label","Notification Number :");parameters.put("notificationNo_value","09L5G2B0966");parameters.put("sectionSchemeInfo", "Information on the Restricted Scheme");parameters.put("schemeNameQn1", "Name of the restricted scheme ("the scheme")");parameters.put("schemeNameQn1_value", "schemname- sdfsdfsd dfasdfasd fasdfasdfasdfasd fasdfasdf dfs fsdaf asdf sadfsdfsda sdf sdfasdf sdfsdafsad sadf sadfsadfsd asdfasd fsadfsaf sd fsdfsd fsdf asdfsda fsddfdEND");parameters.put("NameChangeTo", "changing to");parameters.put("schemeName_q1New", "schemnameNew- sdfsdfsd dfasdfasd fasdfasdfasdfasd fasdfasdf dfs fsdaf asdf sadfsdfsda sdf sdfasdf sdfsdafsad sadf sadfsadfsd asdfasd fsadfsaf sd fsdfsd fsdf asdfsda fsddfdEND");parameters.put("schemeNameEffDateChange_value_1", "on 21/05/2009 ");parameters.put("isSubFundQn2","Is the scheme a sub-fund of an umbrella fund?");parameters.put("isSubFundQn2_value","Yes");parameters.put("umbrellaFundNameQn21","State the name of the umbrella fund");parameters.put("umbrellaFundNameQn21_value", "umbrellafund-sdfasdfasdfasdfasdfasdasdfasdfsadfsadf sdfsadfasdfasfserger erwgwergwergsdfgsdf gsdfgsdfgsdfg fsdgsdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgdfgsdfgsdfgsdfgfdgf END");parameters.put("UmFundNameChangeTo", "changing to");parameters.put("umbrellaFundName_q2_1New", "umfundchange- sdfsdfsd dfasdfasd fasdfasdfasdfasd fasdfasdf dfs fsdaf asdf sadfsdfsda sdf sdfasdf sdfsdafsad sadf sadfsadfsd asdfasd fsadfsaf sd fsdfsd fsdf asdfsda fsddfdEND");parameters.put("umFundEffDateChange_value_1", "on 21/05/2009 ");//==========rest of the parametersparameters.put("incorporationQn8", "Country of incorporation of manager");parameters.put("incorporationQn8_value", "United States Of America");parameters.put("isLicensedQn9", "Is the manager currently licenced or authorised to conduct fund management in the jurisdiction of its principal place of business?");parameters.put("isLicensedQn9_value", "Yes");parameters.put("regulatoryAuthorityQn912", "Name of regulatory authority of manager");parameters.put("regulatoryAuthorityQn912_value", "Rugulatroy Authority Value");//problem started from hereparameters.put("licenceNumberQn92", "Please provide the licence number issued by the relevant regulatory authority");parameters.put("licenceNumberQn92_value", "LicenceNumber-valueL23423423423423342323423423423423423423235252323423423 sdfsdfs bsf5234234234234234234234234234");parameters.put("isPublicQn911", "911Is the Manager a public company that is exempted from the requirement to hold a capital markets services licence to carry on business in fund management under paragraph 5(1)(d) of the Second Schedule of the Securities and Futures (Licensing and Conduct of Business) Regulations?");parameters.put("isPublicQn911_value", "Yes");//importing fontHashMap fontMap = new HashMap(); fontMap.put(new FontKey("Times New Roman", false, false),new PdfFont("D:\JasperReport\fromsvn\fonts\times.ttf",BaseFont.IDENTITY_H,true));fontMap.put(new FontKey("Times New Roman", true, false),new PdfFont("D:\JasperReport\fromsvn\fonts\timesbd.ttf",BaseFont.IDENTITY_H,true));fontMap.put(new FontKey("Times New Roman", false, true),new PdfFont("D:\JasperReport\fromsvn\fonts\timesi.ttf",BaseFont.IDENTITY_H,true)); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.CHARACTER_ENCODING,"UTF-8");exporter.setParameter(JRPdfExporterParameter.FONT_MAP, fontMap);JasperPrint jp =JasperFillManager.fillReport(destFilename, parameters,new JREmptyDataSource());exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT,jp); exporter.setParameter(JRPdfExporterParameter.OUTPUT_FILE_NAME,"D:\JasperReport\jasper1.pdf");exporter.exportReport(); }Catch(Exception e)}//main} Link to comment Share on other sites More sharing options...
lucianc Posted March 31, 2009 Share Posted March 31, 2009 The PDF you attached does not seem to be obtained with the Java code you posted. For one, the Java code doesn't compile, and then the PDF contains some labels that are not present in the code (nor the JRXML) - e.g. the "Is the scheme constituted in Singapore?" text.Please post a proper test case for this if you want us to investigate it.Regards,Lucian Link to comment Share on other sites More sharing options...
callrmk Posted April 1, 2009 Author Share Posted April 1, 2009 Hi,Please find the attached xml,java file and the PDF generated.I have removed font related stuff so that it will compile.Please try adding some more data to the parameters,as the data moves down on the PDF,some other fields may disappear while paginating.Greatly appreciate your help.Thank you,Regards,Mohan Code: Post Edited by mohan kumar at 04/01/09 02:52Post Edited by mohan kumar at 04/01/09 03:16 Link to comment Share on other sites More sharing options...
lucianc Posted April 6, 2009 Share Posted April 6, 2009 The text was missing because of a bug in the JasperReports engine. A fix has been checked into the JR SVN trunk (rev. 2722).One way to workaround this problem is to break your band into several dummy bands (as explained in this FAQ), thus isolating each horizontal group of elements into its own band.Regards,Lucian Link to comment Share on other sites More sharing options...
lucianc Posted April 14, 2009 Share Posted April 14, 2009 New development on this: It turned out that the fix I mentioned in my previous post was problematic, so we had to revert it.The only solution to your layout is to isolate horizontal element groups into dummy bands or into frames.Regards,Lucian Link to comment Share on other sites More sharing options...
rkriitr Posted July 17, 2011 Share Posted July 17, 2011 Hi Sorry to start this old thread after two years, but I am facing this similar problem. On next page report is missing one line and then next line onwards everything is normal. After going through the FAQ link, one thing is unclear that if it is height confusion, then why only first line or next line partially (in case of Mohan) is not printing and then rest of them are printing. In my case, I have put elements into their own frame and then all frames together into one big frame.I want to understand the problem. Link to comment Share on other sites More sharing options...
rodney.barbati Posted July 17, 2017 Share Posted July 17, 2017 Things I would try to resolve this... I notice you are passing a significant amount of text as parameters. I also observe that you are saying that that significant amount of text is what is being truncated in the report output. I would guess (with a strong chance that this is the case), that the width of the element is not sufficient to contain the text AND that the element is not set to grow vertically AND that the band the element is in is not actually large enough vertically to contain said text.So, that means the element receiving the text should be widened, it should be set to stretch vertically (it will word wrap within its width) ie. field.setStretchType(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT). This will cause it to grow to the height of the band it is in.Make sure the band is large enough to contain the text.An alternative to the above is to actually create the report such that each page is a separate report definition. You would create a report definition for each distinct page using only the detail band and turning off all other bands. You would then create the actual report definition and include the distinct page definitions in its detail band as subreports. The containing report definition could then have actual report headers and footers, and the subreports take care of laying out each page. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now