0

Consider a report page consisting of header, detail-top, detail-bottom and footer. I have a service which will run an "App". This App will produce what will ultimately appear in the detail-bottom portion of the report. It will store its output in a file system. After App has produced its output (and shutdown), a seperate "Service" will produce the final report "merging" the content produced by the App (the service provides the content of the header, footer and detail-top areas). If I was generating this by hand in Word, I would be in essense inserting a word document into final report document as an object.

I'm trying to identify an appropriate technology to accomplish this.

Requirements include:

  1. The Service producing the final report will be a Java service runnig on a Linux machine. I will be developing this code.
  2. The App producing the detail-bottom content could be a Windows (e.g., C#) or Linux (e.g., Java) application. Any number of other developers would be developing this code and interfacing with my service through a SDK I will provide. They are presumed to be skilled developers but I don't know what experience they have with any report generation technology
  3. The template utilized by the service will give the same look & feel to the finished report regardless of the App that is run, while the App will have total control over the content of the detail-bottom section of the finished report. In other words, if the template allocates a "frame" of say 7Wx5H in the finished report for the detail-bottom section, the App would in essence have a 7x5W blank page to work with.
  4. The finished report could be multiple pages and the first page could be different than the remaining pages. If the App produces multiple (e.g., 7Hx5W pages), the service would merge each App page into the detail-bottom section of each page of the finished report, thereby leaving the App to deal with pagenation as it would if it was producing the entire report itself.
  5. At some point I want to provide the end user a UI for managing the layout of the finished report (template).
  6. I'll don't really care how the App developer produces the content to be inserted into detail-bottom frame and as he is providing me with a finished executable for me to run, I will not provide him with any UI to manage his report layout/content
  7. The finished report delivered to the end user will be as a PDF.
  8. Since I'm not sure about the skill set of the App developer and there could be many Apps and developers, I want them to produce output I can accept for merging into the dertail-bottom frame with is well accepted, supported and not overly burdensome to use.

Various technologies suggested to me thus far are:

  1. Apache FOP (XML-FO)
  2. DOCX
  3. itext
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84
Scott Kellish
  • 159
  • 2
  • 6
  • If the App produces multiple pages, does the Service put identical content on each page or not? – JasonPlutext Nov 04 '12 at 19:29
  • No, it would be a 1:1 match. If the App produced 5 pages, we would produce 5 pages from the template and merge each page from the App into the corresponding page in the final (App-P1 merged into Final-P1, App-P2 into Final-P2, ... Customer would likely create a two page template with page 1 describing the front page and page 2 describing all the remaining pages. The botton-detail frame could be different size on each – Scott Kellish Nov 05 '12 at 00:48

2 Answers2

1

Here's a solution using FOP:

  • Have the application save the respective data to two XML-Files with fixed names. So, your API would be a XML document schema the data producer would have to stick to.

  • provide an XSL file which contains the layout for the complete PDF and reads back the two files using the document() xsl function.

  • In order to process several reports at the same time, use one directory for each report.

  • FOP would take care of pagination.

If you want to have the layout configurable by the end user, you can let them change the xsl in ways defined by the application. You could also split the XSL into several portions (for the first report, for the second report, for the overall layout) and import them all into one master template.

hbarck
  • 2,934
  • 13
  • 16
0

If the final output is a PDF, which gives exact control over appearance, why not allow the apps producing the bottom frame to also produce PDFs which give exact control over appearance?

One feature supported by PDFs is a "Form XObject" which allows the inclusion of content from one PDF into another one. You can even take particular rectangles off a page, so you could allow the app to create any size PDF it wants, and to specify the rectangle enclosing the content.

There must be Java libraries that support Form XObjects, because it's not that hard. I have written a Python library names pdfrw that allows you to merge pages this way quite easily. I haven't yet documented it all that well, but there are several examples on that site, and a very relevant one here

Community
  • 1
  • 1
Patrick Maupin
  • 8,024
  • 2
  • 23
  • 42