Well, I've knocked up some stuff for real using iText now. The rose-tinted glasses are off for sure, but I have to say, it's a good solution.
Writing a long complex report with a lot of formatting is pretty dull, it must be said. But that's the nature of the beast, really - northing's going to make report generation exciting. iText does at least make it relatively easy to get exactly the result you need.
The mailing list, as I usually find in the open source world, pisses all over the "support" that you'll get from the proprietary world. So, a big thank you to Bruno Lowagie and Paulo Soares, not only for writing iText in the first place, but for their time over on itext-questions.
The code that you have to write is pretty ugly, I must say. It's really procedural, and it's long. There are a lot of repetitious sections that look like they could be refactored into methods to avoid code duplication, but that you find are different enough that you can't - at least, not without making the code really complex. And while the report generation code is long, it's also very simple; add a paragraph, add a table cell, add another table cell, and so on, and so on.
One thing I would like to be able to work out how to do is unit test. I already know that my domain objects work - they have their own unit test. So I really just need to make sure that the PDFs are generated correctly, and I can only do that by eye. Anyone have any good suggestions here?
Anyway, in short, I wouldn't hesitate to recommend iText over StyleReport or the like to anyone who can code.
Posted to Java by Simon Brunning at September 23, 2004 01:23 PMPerhaps an intermediate unit test would be to verify that the composite objects - paragraph, tables, sections, etc, are correctly linked together/set up.
That is, run the report file out in test mode, and verify that
(a) the right file name was produced and it contains a non-zero number of bytes, maybe even shell it into acrobat and check if no errors occur, and
(b) then inspect the objects created inside your class to see thet they have the right structure.
Might not be the best, but it will certainly be a start.
Posted by: Mark Matthews on September 23, 2004 01:37 PMDo you try the Form filling with itext
it rocks
;)
You should avoid testing iText itself I think, unless you have a seperate acceptance test. Therefore, you should test what you are passing to iText in the first place - does iText take XML as an input? If so, you could use XPath queries (XPath is built in to Java 1.4) to check the content of the code, or even simple string comparisons. The XPath queries will be less brittle than a simple text comparison, but might be more work (but also I suspect more maintainable).
Posted by: Sam Newman on September 23, 2004 03:40 PMYou don't really pass it anything except for chunks of string - you just call a bunch of iText classes. So, for example, I create a paragraph of mixed format text like so:
currentCell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(new Paragraph("(8)", FONT_BODY));
paragraph = new Paragraph();
paragraph.add(new Chunk("A separate Section B should be completed for each different ",
FONT_BODY));
paragraph.add(new Chunk("Currency", FONT_BODY_BOLD));
paragraph.add(new Chunk(
". Where the names of currencies are similar – for example US Dollars and Australian Dollars – these should be clearly stated. If it is unclear what currency your claim is in, your claim for voting purposes may be rejected in whole or in part.",
FONT_BODY));
currentCell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
table.addCell(paragraph);
Well, there are two things you can test in that case
1.) That you are making the right iText calls based on program execution - so make sure your code calls addCell in the right places. For that you just have to Mock out the paragraph and replace some of your constructors with a factory.
2.) Just do manual acceptance tests on the reports.
I guess it depends on how many reports you have - if you have one or two then manual acceptance tests should be so bad. If you have loads though (or an overworked QA) the work to allow automated testing might be worth it.
Posted by: Sam Newman on September 23, 2004 04:27 PMEven simpler, just abstract out your use of iText altogether, then mock your abstraction when testing. Then you're not testing iText, but your use of iText, which is as it should be. I kind of meant that before, but wasn't very clear :-)
Posted by: Sam Newman on September 23, 2004 04:28 PM"And while the report generation code is long, it's also very simple"... there's always the Ghetto mini-pattern for dealing with that. And if it's a pattern, it has to be good...
http://fishbowl.pastiche.org/2003/05/28/the_ghetto_minipattern
Half my bloody project is a Ghetto...
Posted by: Simon Brunning on September 24, 2004 08:44 AMHave you thought about using Apache FOP and XSL-FO for reporting?
Posted by: Ben Galbraith on September 24, 2004 04:11 PMpdytixal kmqnygow zqhk zfaeurpd gxvwaouc cjnd xvlbfwns http://www.nexbdtsq.zvdn.com
Posted by: ptnjas wmsre on March 30, 2009 06:59 AMyvsxzr nbqucvt
http://carnival-cruise.greatnow.com/index.html carnival cruise
tavbnid
http://postcard-printing.greatnow.com/index.html postcard printing
vmgybsp rvcuks
http://postcard-printing.greatnow.com/4x6-postcard-printing.html 4x6 postcard printing
http://postcard-printing.greatnow.com/5k-postcard-printing.html 5k postcard printing
http://postcard-printing.greatnow.com/free-postcard-maker-download-printing.html free postcard maker download printing
http://postcard-printing.greatnow.com/wedret-search-tpl-main-postcard-printing.html wedret search tpl main, postcard printing
http://postcard-printing.greatnow.com/variable-data-postcard-printing.html variable data postcard printing
http://postcard-printing.greatnow.com/variable-data-postcard-printing-arizona.html variable data postcard printing arizona
http://postcard-printing.greatnow.com/postcard-printing-and-mailing.html postcard printing and mailing
http://postcard-printing.greatnow.com/postcard-printing-los-angeles.html postcard printing los angeles
http://postcard-printing.greatnow.com/postcard-printing-service.html postcard printing service
http://postcard-printing.greatnow.com/postcard-printing-services.html postcard printing services
sfnbyac
http://postcard-printing.greatnow.com/postcard-printing-software.html postcard printing software
sfnbyac
http://postcard-printing.greatnow.com/postcard-printing-software.html postcard printing software
uoclar
http://drug-detox.greatnow.com/index.html drug detox
$1,15Buy Generic Viagra
Buy Online Viagra
Buy Cheap Viagra
Viagra Buy
Buy Viagra
Buy Viagra On Line
Buy Viagra Now Online
Where Buy Generic Viagra
Buy Generic Viagra
http://www.english.heacademy.ac.uk/virtue/user/view.php?id=2246&course=1&key=Buy+Viagra+Now+Online Buy Cheap Viagra
http://www.english.heacademy.ac.uk/virtue/user/view.php?id=2246&course=1&key=Buy+Online+Viagra Where To Buy Viagra
http://www.english.heacademy.ac.uk/virtue/user/view.php?id=2246&course=1&key=Buy+Viagra Viagra Buy
http://www.itce.alquds.edu/etraining/user/view.php?id=6108&course=1&key=Buy+Viagra Viagra Buy
http://www.irel-open.ie/user/view.php?id=15289&course=1&key=Buy+Viagra+Alternative Where Buy Generic Viagra
http://www.irel-open.ie/user/view.php?id=15289&course=1&key=Buy+Viagra+Now+Online Viagra Buy
http://motivate.maths.org/moodle/user/view.php?id=1807&course=1&key=Buy+Viagra+Alternative Buy Viagra Now
http://www.english.heacademy.ac.uk/virtue/user/view.php?id=2246&course=1&key=Buy+Viagra+On+Line Buy Generic Viagra
http://www.medvetnet.org/moodle/user/view.php?id=118&course=1&key=Buy+Viagra+On+Line Buy Viagra Alternative
viagra plant buy viagra canada herbal viagra australia viagra softtabs florida viagra online viagra reviewa buy viagra search find free viagra blue big love bush buy porn viagra edinburgh pages free find viagra search viagra before and after viagra discount sales generic name viagra buy viagra in malaysia enzyte vs viagra methadone and viagra by mail sale viagra good screw with viagra href bigger erection with viagra what is viagra affiliate directory viagra generic viagra sold on line the city that viagra built generic viagra no prescriptio in use viagra woman success of viagra pharmaceutical canadian approved female viagra order viagra now discount viagra furthermore cheap adipex reviews canadian drug viagra actress viagra sports show tape commercial viagra drugs online health south cover viagra buy viagra phentermine meridia adipex xenical low cost generic viagra barefoot man viagra mail viagra viagra 100mg tablets no prescription cheap viagra description viagra contents of viagra cheap levitra tramadol ultram viagra viagra british store boot 3 cialis generic levitra viagra generac viagra viagra ejaculation 3 generic sildenafil viagra uprima cialis viagra viagra sell viagra seller viagra sample overnight delivery viagra the pill vrx v herbal viagra will viagra work on young males snoring and viagra viagra student loan consolidation buy viagra for women can i buy viagra with paypal viagra retail discount
qmtv
http://tanning-bedss.greatnow.com/index.html tanning beds
kynew shikzb
http://tanning-bedss.greatnow.com/used-tanning-beds-for-sale.html used tanning beds for sale
http://tanning-bedss.greatnow.com/electronic-ballast-for-tanning-beds.html electronic ballast for tanning beds
http://tanning-bedss.greatnow.com/girls-in-tanning-beds.html girls in tanning beds
http://tanning-bedss.greatnow.com/stand-up-tanning-beds.html stand up tanning beds
http://tanning-bedss.greatnow.com/high-pressure-tanning-beds.html high pressure tanning beds
http://tanning-bedss.greatnow.com/esb-tanning-beds.html esb tanning beds
http://tanning-bedss.greatnow.com/wholesale-tanning-beds.html wholesale tanning beds
http://tanning-bedss.greatnow.com/cheap-tanning-lotions-for-tanning-beds.html cheap tanning lotions for tanning beds
http://tanning-bedss.greatnow.com/ets-tanning-beds.html ets tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-for-sale-commercial-use.html tanning beds for sale commercial use
kynew shikzb
http://tanning-bedss.greatnow.com/used-tanning-beds-for-sale.html used tanning beds for sale
http://tanning-bedss.greatnow.com/electronic-ballast-for-tanning-beds.html electronic ballast for tanning beds
http://tanning-bedss.greatnow.com/girls-in-tanning-beds.html girls in tanning beds
http://tanning-bedss.greatnow.com/stand-up-tanning-beds.html stand up tanning beds
http://tanning-bedss.greatnow.com/high-pressure-tanning-beds.html high pressure tanning beds
http://tanning-bedss.greatnow.com/esb-tanning-beds.html esb tanning beds
http://tanning-bedss.greatnow.com/wholesale-tanning-beds.html wholesale tanning beds
http://tanning-bedss.greatnow.com/cheap-tanning-lotions-for-tanning-beds.html cheap tanning lotions for tanning beds
http://tanning-bedss.greatnow.com/ets-tanning-beds.html ets tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-for-sale-commercial-use.html tanning beds for sale commercial use
wsgkd
http://tanning-bedss.greatnow.com/cheap-used-tanning-beds.html cheap used tanning beds
http://tanning-bedss.greatnow.com/used-home-tanning-beds.html used home tanning beds
http://tanning-bedss.greatnow.com/sunpro-tanning-beds.html sunpro tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-and-pregnancy.html tanning beds and pregnancy
http://tanning-bedss.greatnow.com/photo-of-skin-damage-by-tanning-beds.html photo of skin damage by tanning beds
http://tanning-bedss.greatnow.com/canopy-tanning-beds.html canopy tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-lamps.html tanning beds lamps
http://tanning-bedss.greatnow.com/tanning-beds-suppliers.html tanning beds suppliers
http://tanning-bedss.greatnow.com/home-tanning-beds-for-sale.html home tanning beds for sale
http://tanning-bedss.greatnow.com/buying-tanning-beds.html buying tanning beds
gout
http://tanning-bedss.greatnow.com/how-to-use-tanning-beds.html how to use tanning beds
http://tanning-bedss.greatnow.com/questions-about-tanning-in-tanning-beds.html questions about tanning in tanning beds
http://tanning-bedss.greatnow.com/prosun-tanning-beds.html prosun tanning beds
http://tanning-bedss.greatnow.com/used-commercial-tanning-beds.html used commercial tanning beds
http://tanning-bedss.greatnow.com/comercial-tanning-beds.html comercial tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-while-pregnant.html tanning beds while pregnant
http://tanning-bedss.greatnow.com/wolfe-tanning-beds.html wolfe tanning beds
http://tanning-bedss.greatnow.com/how-to-tan-in-tanning-beds.html how to tan in tanning beds
http://tanning-bedss.greatnow.com/cancer-from-tanning-beds.html cancer from tanning beds
http://tanning-bedss.greatnow.com/tropical-rayz-tanning-beds.html tropical rayz tanning beds
mweu hslycn tynei
http://tanning-bedss.greatnow.com/residential-tanning-beds.html residential tanning beds
http://tanning-bedss.greatnow.com/are-tanning-beds-safe.html are tanning beds safe
http://tanning-bedss.greatnow.com/wholesale-home-tanning-beds.html wholesale home tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-for-less.html tanning beds for less
http://tanning-bedss.greatnow.com/tanning-bedsrash.html tanning beds,rash
http://tanning-bedss.greatnow.com/tanning-beds-wholesale.html tanning beds wholesale
http://tanning-bedss.greatnow.com/sun-tanning-beds.html sun tanning beds
http://tanning-bedss.greatnow.com/safe-tanning-beds.html safe tanning beds
http://tanning-bedss.greatnow.com/indoor-tanning-beds.html indoor tanning beds
http://tanning-bedss.greatnow.com/new-tanning-beds-in-little-rock-arkansas.html new tanning beds in little rock arkansas
ujqkzn
http://tanning-bedss.greatnow.com/sundash-tanning-beds.html sundash tanning beds
http://tanning-bedss.greatnow.com/lotions-for-tanning-beds.html lotions for tanning beds
http://tanning-bedss.greatnow.com/tanning-beds-effects.html tanning beds effects
http://tanning-bedss.greatnow.com/tanning-beds-for-sale-gainesville-fl.html tanning beds for sale gainesville fl
http://tanning-bedss.greatnow.com/tanning-beds-in-raleigh-nc.html tanning beds in raleigh nc
http://tanning-bedss.greatnow.com/repo-tanning-beds.html repo tanning beds
http://tanning-bedss.greatnow.com/older-model-tanning-beds.html older model tanning beds
http://tanning-bedss.greatnow.com/pictures-of-tanning-beds.html pictures of tanning beds
http://tanning-bedss.greatnow.com/commercial-tanning-beds-for-sale.html commercial tanning beds for sale
http://tanning-bedss.greatnow.com/esb-tanning-beds-parts.html esb tanning beds parts