私はpdfboxとitexpdfを使用して、非常に単純な請求書をpdf形式で作成しています。
Javaの外部のerpシステムで生の請求書テキストファイルを作成しているので、テキストファイルを(pdf)テンプレートと組み合わせて実行する必要があるのは1つだけです。(それは問題ではありません。;))
正常に動作していますが、PDFでインデントエラーが見つかりました。テーブルのヘッダーの後、インデントが正しくありません(先頭の空白が1つ削除されています)。
私が間違っているのは何ですか?
これがコードで、サンプルpdfを生成します。
final File outputFile = this.createTmpFile();
final Document document = new Document(PageSize.A4);
PdfWriter.getInstance(document, new FileOutputStream(outputFile));
document.open();
final StringBuffer testText = new StringBuffer();
testText.append(" 21.12.2012\n");
testText.append("\n");
testText.append("\n");
testText.append("\n");
testText.append("Invoice\n");
testText.append("\n");
testText.append("\n");
testText.append("Amount Description CUR Price\n");
testText.append("===========================================================================\n");
testText.append("\n");
testText.append(" 1 Order #E41141454 from 01.01.2012: EUR 21,21\n");
testText.append(" nice text, nice text, nice text, nice text,\n");
testText.append(" nice text, nice text, nice text, nice text,\n");
testText.append("\n");
testText.append(" Status: online\n");
final Paragraph para = new Paragraph();
para.setFont(new Font(FontFamily.COURIER, 8.6f));
para.setAlignment(Element.ALIGN_UNDEFINED);
para.setLeading(1.2f, 1.2f);
final String t = testText.toString();
para.add(t);
document.add(para);
document.close();