m***@mw-informatik.ch
2009-11-10 13:25:52 UTC
Hi Bruno, Paulo and all the other iText cracks,
I have to implement for a big insurance company a PDF including thousands of statement of accounts. This mission-critical application runs on IBM z/OS as a Java batch job (WebSphere XD). You would like to share my design considerations and issues with you and appreciate your comments and recommendations. Many thanks in advance that you spend time to support me. I like to iText book and the comprehensive samples.
1. Requirements
PDF includes up to 3'500 statement of accounts, a statement of account can have up to 50 pages, we do not expect that the PDF has more than 20'000 pages. A typical batch-run creates a PDF with 3'500 statement of accounts with a maximum of 3 pages per statement of account. The parameters for the batch job are: range of account numbers, period, 2 - 4 variable table columns (fixed columns are: debit, credit, balance). The first page of the statement includes: page header with the address of the account owner, a table with 5 to 7 columns with a table header and 30 body rows. Page two and upward of the statement has no page header, layout of the table is equivalent to page one (table header), with 50 body rows. End of statement: empty row followed by a total row for debit, credit and balance. Each statement has its own page number in the footer (page x/y). The footer has a fix text (same content and position for all pages, independent of statement). Each odd table body row is gray underlayed ("table background"), including empty rows at the end of the table.
2. Design
Applying PdfStamper and PdfCopy
I intend to create the statement_of_accounts.pdf in several steps:
1. For each statement: prepare a statement document (statement_without_pageNumber.pdf). Add "tableBackground_first_page" PdfTemplate to the first page and "tableBackground_further_pages" PdfTemplate to the further pages via PdfPTableEvent handling
2. for each statement: stamp page number with PdfStamper (statement_with_pageNumber.pdf)
3. Add statement_with_pageNumber.pdf to the statement_of_accounts_without_footer.pdf) with PdfCopy
4. Stamp the footer (PdfTemplate) with PdfStamper (statement_of_accounts.pdf = final PDF)
The first two documents (statement_without_pageNumber.pdf / statement_with_pageNumber.pdf) are temporary files reused for each statement
3. My concerns
3.1. "table background" templates (first page / further pages)
Each statement_without_pageNumber.pdf (created in step 1) includes one (statement with one page) or two (statements with more than one page) templates. A typical batch-run creates 3'500 statements which are concatenated in step3. Is it possible the share a template across a document to reduce the pdf size ? Other (better ?) solutions to implement the "table background". Please be aware that the "table background" has to be calculated per batch-job because of the variable columns
3.2. Is step 4 (stamps a fix page footer text via PdfTemplate) an overkill ?
Rationale: template with the footer text appears only once in the fine pdf (statement_of_accounts.pdf)
4. Do you have other concerns / issues with the design ?
Again, many thanks for your help.
Kind regards,
Martin
I have to implement for a big insurance company a PDF including thousands of statement of accounts. This mission-critical application runs on IBM z/OS as a Java batch job (WebSphere XD). You would like to share my design considerations and issues with you and appreciate your comments and recommendations. Many thanks in advance that you spend time to support me. I like to iText book and the comprehensive samples.
1. Requirements
PDF includes up to 3'500 statement of accounts, a statement of account can have up to 50 pages, we do not expect that the PDF has more than 20'000 pages. A typical batch-run creates a PDF with 3'500 statement of accounts with a maximum of 3 pages per statement of account. The parameters for the batch job are: range of account numbers, period, 2 - 4 variable table columns (fixed columns are: debit, credit, balance). The first page of the statement includes: page header with the address of the account owner, a table with 5 to 7 columns with a table header and 30 body rows. Page two and upward of the statement has no page header, layout of the table is equivalent to page one (table header), with 50 body rows. End of statement: empty row followed by a total row for debit, credit and balance. Each statement has its own page number in the footer (page x/y). The footer has a fix text (same content and position for all pages, independent of statement). Each odd table body row is gray underlayed ("table background"), including empty rows at the end of the table.
2. Design
Applying PdfStamper and PdfCopy
I intend to create the statement_of_accounts.pdf in several steps:
1. For each statement: prepare a statement document (statement_without_pageNumber.pdf). Add "tableBackground_first_page" PdfTemplate to the first page and "tableBackground_further_pages" PdfTemplate to the further pages via PdfPTableEvent handling
2. for each statement: stamp page number with PdfStamper (statement_with_pageNumber.pdf)
3. Add statement_with_pageNumber.pdf to the statement_of_accounts_without_footer.pdf) with PdfCopy
4. Stamp the footer (PdfTemplate) with PdfStamper (statement_of_accounts.pdf = final PDF)
The first two documents (statement_without_pageNumber.pdf / statement_with_pageNumber.pdf) are temporary files reused for each statement
3. My concerns
3.1. "table background" templates (first page / further pages)
Each statement_without_pageNumber.pdf (created in step 1) includes one (statement with one page) or two (statements with more than one page) templates. A typical batch-run creates 3'500 statements which are concatenated in step3. Is it possible the share a template across a document to reduce the pdf size ? Other (better ?) solutions to implement the "table background". Please be aware that the "table background" has to be calculated per batch-job because of the variable columns
3.2. Is step 4 (stamps a fix page footer text via PdfTemplate) an overkill ?
Rationale: template with the footer text appears only once in the fine pdf (statement_of_accounts.pdf)
4. Do you have other concerns / issues with the design ?
Again, many thanks for your help.
Kind regards,
Martin