• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reporting Software
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reporting Software


  • Subject: Re: Reporting Software
  • From: email@hidden
  • Date: Fri, 24 Oct 2003 14:16:25 +1300

Hello Greg;

As Jake mentioned, FOP is quite good. I write FO: out into a component and then do this in the controller class...
(you can look at "nzmac.lindesay.co.nz" for an example of this working on the search results)


	public void appendToResponse(WOResponse response, WOContext context)
    {
        long millisecsToMakePDF = 0;
        dataKeys.removeAllObjects();
        super.appendToResponse(response, context);

        ByteArrayOutputStream pdfOut = new ByteArrayOutputStream();

try
{
ByteArrayInputStream foIn = new ByteArrayInputStream(response.content().bytes());
org.xml.sax.InputSource foIs = new org.xml.sax.InputSource(new InputStreamReader(foIn));


            Driver driver = new Driver(foIs, pdfOut);
            driver.setRenderer(Driver.RENDER_PDF);

            Date before = new Date();
            driver.run();
            Date after = new Date();

            millisecsToMakePDF = after.getTime() - before.getTime();
        }
        catch(IOException ioe)
        { throw new LEError("exception creating a PDF",ioe); }
        catch(FOPException fe)
        { throw new LEError("exception creating a PDF",fe); }

response.setContentEncoding("UTF8");
response.setHeader("application/pdf", "content-type");
response.setHeader("filename=MPDUOrganisationList.pdf","Content- Disposition");
response.setContent(new NSData(pdfOut.toByteArray()));
response.setStatus(WOMessage.HTTP_STATUS_OK);


WOResourceManager rm = WOApplication.application().resourceManager();
for(int i=0;i<dataKeys.count();i++)
rm.removeDataForKey((String) dataKeys.objectAtIndex(i),session());


NSLog.out.appendln(LEWOLogHelper.singleton().logFormat(
MPDUConstants.LOG_MAKEPDF,
"pdf of organisation list created in "+(millisecsToMakePDF/1000)+" seconds",
context(), null));
}


___
Andrew Lindesay
http://www.lindesay.co.nz/
+64 21 47 0929
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Newbie: Mixing HTML & WO Pages?
  • Next by Date: EditingConcept?
  • Previous by thread: Re: Reporting Software
  • Next by thread: EditingConcept?
  • Index(es):
    • Date
    • Thread