I am using an cool product called xmlMill, you build an XML document then you run a transformation on the xml page, and a PDF is gen'd. Very cool, very fast dan ----- Original Message ----- From: "Daniel Haynes" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Thursday, October 24, 2002 9:28 AM Subject: RE: PDF generation with Struts
> Report Action from our app below > > Dan > > public ActionForward executeAction (ActionMapping mapping, ActionForm form, > HttpServletRequest request, > > HttpServletResponse response) throws Exception > { > MessageResources messages = getResources(request); > ActionMessages actionMessages = new ActionMessages(); > actionMessages.add(IConstants.SCREEN_TITLE_KEY, new > ActionMessage("title.report")); > > User user = > (User)request.getSession().getAttribute(IConstants.USER_KEY); > > UserSession userSession = > (UserSession)request.getSession().getAttribute(IConstants.USER_SESSION_KEY); > > > String userid = user.getUserid(); > String username = user.getUsername(); > String fmgid = user.getFmgID(); > String currentIntervalID = userSession.getIntervalID(); > String businessAreaID = userSession.getBusinessAreaID(); > String regionID = "1"; > String action = request.getParameter("action"); > ReportForm reportForm = (ReportForm)form; > > if (action.equals("New") || action.equals("Reset")) > { > actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new > ActionMessage("report.welcometext")); > // Populate the drop down fields > reportForm.setReports(getReports()); > reportForm.setIntervals(getDropDownIntervals()); > reportForm.setIndustries(getAllDropDownIndustries()); > reportForm.setQualities(getOverallDropDownQualities()); > reportForm.setFMGGroups(getDropDownFMGGroups()); > reportForm.setBrokers(getDropDownBrokers()); > reportForm.setBrokerGroup("All"); > reportForm.setInterval(userSession.getIntervalID()); > // Set defaults > reportForm.setReportType("1"); > reportForm.setMarkets(getDropDownMarkets()); > reportForm.setMarket(IConstants.ALL_INDICATOR); > reportForm.setBrokers(getFMGBrokersByMarket(fmgid, > reportForm.getMarket())); > > } > > // The user has changed the report selection, just re-display the new > form format > if (action.equals("Change")) > { > actionMessages.add(ActionMessages.GLOBAL_MESSAGE, new > ActionMessage("report.welcometext")); > > // Update the markets drop down to contain the > correct list (with or without "All") > // and ensure that the list of brokers is correct > for the market classification > int reportType = > Integer.parseInt(reportForm.getReportType()); > switch(reportType) > { > case 1: > reportForm.setMarkets(getDropDownMarkets()); > break; > case 4: > > reportForm.setMarket(IConstants.ALL_INDICATOR); > > reportForm.setBrokers(getFMGBrokersByMarket(fmgid, > IConstants.ALL_INDICATOR)); > break; > case 5: > reportForm.setMarkets(getAllDropDownMarkets()); > > reportForm.setBrokers(getFMGBrokersByMarket(fmgid, reportForm.getMarket())); > break; > default: > reportForm.setMarkets(getAllDropDownMarkets()); > break; > } > } > > if (action.equals("Create Report")) > { > Report report = new Report(); > report.setFmgID(fmgid); > report.setReportType(reportForm.getReportType()); > report.setMarketID(reportForm.getMarket()); > report.setIndustryID(reportForm.getIndustry()); > report.setIntervalID(reportForm.getInterval()); > report.setBrokerID(reportForm.getBroker()); > report.setQualityID(reportForm.getQuality()); > report.setFMGGroupID(reportForm.getFMGGroup()); > report.setBusinessAreaID(businessAreaID); > report.setRegionID(regionID); > report.setCurrentIntervalID(currentIntervalID); > report.setBrokerGroup(reportForm.getBrokerGroup()); > setReportNames(report); > ReportAdapterService service = new ReportAdapterService(); > ByteArrayOutputStream stream = null; > stream = service.getStream(report); > > if(stream != null) > { > response.setHeader("Content-Disposition", > "inline;filename=MyReport.pdf; "); > response.setContentType("application/pdf"); > response.setContentLength(stream.size()); > > ServletOutputStream out = response.getOutputStream(); > stream.writeTo(out); > out.flush(); > out.close(); > return null; > } > else > { > actionMessages.add(IConstants.USER_ACTION_FEEDBACK, new > ActionMessage("report.noreport")); > } > > } > saveMessages(request, actionMessages); > return mapping.findForward(IConstants.SUCCESS_KEY); > } > > -----Original Message----- > From: Bruno Collet [mailto:b_collet@;yahoo.com] > Sent: 24 October 2002 14:23 > To: [EMAIL PROTECTED] > Subject: PDF generation with Struts > > > Hi all, > Is there an easy way to generate PDF documents using > Struts? > Bruno > > __________________________________________________ > Do you Yahoo!? > Y! Web Hosting - Let the expert host your web site > http://webhosting.yahoo.com/ > > -- > To unsubscribe, e-mail: > <mailto:struts-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: > <mailto:struts-user-help@;jakarta.apache.org> > > -- > To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> > -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>