本文整理汇总了Java中com.lowagie.text.PageSize.LETTER属性的典型用法代码示例。如果您正苦于以下问题:Java PageSize.LETTER属性的具体用法?Java PageSize.LETTER怎么用?Java PageSize.LETTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.lowagie.text.PageSize
的用法示例。
在下文中一共展示了PageSize.LETTER属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDocumentProps
private void addDocumentProps(Document document, String title, Properties props) {
document.addTitle(title);
document.addSubject("");
document.addKeywords("pdf, itext");
document.addCreator("OSCAR");
document.addAuthor("");
// A0-A10, LEGAL, LETTER, HALFLETTER, _11x17, LEDGER, NOTE, B0-B5, ARCH_A-ARCH_E, FLSA
// and FLSE
// the following shows a temp way to get a print page size
final String PAGESIZE = "printPageSize";
Rectangle pageSize = PageSize.LETTER;
if ("PageSize.HALFLETTER".equals(props.getProperty(PAGESIZE)))
pageSize = PageSize.HALFLETTER;
if ("PageSize.A6".equals(props.getProperty(PAGESIZE)))
pageSize = PageSize.A6;
document.setPageSize(pageSize);
document.open();
}
示例2: getPdfDoc
protected com.lowagie.text.Document getPdfDoc() throws IOException, DocumentException {
String reportDropFolder = reportsDirectory + "/" + ArConstants.Lockbox.LOCKBOX_REPORT_SUBFOLDER + "/";
String fileName = ArConstants.Lockbox.BATCH_REPORT_BASENAME + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmssSSS").format(dateTimeService.getCurrentDate()) + ".pdf";
// setup the writer
File reportFile = new File(reportDropFolder + fileName);
FileOutputStream fileOutStream;
fileOutStream = new FileOutputStream(reportFile);
BufferedOutputStream buffOutStream = new BufferedOutputStream(fileOutStream);
com.lowagie.text.Document pdfdoc = new com.lowagie.text.Document(PageSize.LETTER, 54, 54, 72, 72);
PdfWriter.getInstance(pdfdoc, buffOutStream);
pdfdoc.open();
return pdfdoc;
}
示例3: getPdfDoc
protected com.lowagie.text.Document getPdfDoc() throws IOException, DocumentException {
String reportDropFolder = reportsDirectory + "/" + ArConstants.CustomerInvoiceWriteoff.CUSTOMER_INVOICE_WRITEOFF_REPORT_SUBFOLDER + "/";
String fileName = ArConstants.CustomerInvoiceWriteoff.BATCH_REPORT_BASENAME + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmssSSS").format(dateTimeService.getCurrentDate()) + ".pdf";
// setup the writer
File reportFile = new File(reportDropFolder + fileName);
FileOutputStream fileOutStream;
fileOutStream = new FileOutputStream(reportFile);
BufferedOutputStream buffOutStream = new BufferedOutputStream(fileOutStream);
com.lowagie.text.Document pdfdoc = new com.lowagie.text.Document(PageSize.LETTER, 54, 54, 72, 72);
PdfWriter.getInstance(pdfdoc, buffOutStream);
pdfdoc.open();
return pdfdoc;
}
示例4: addDocumentProps
private void addDocumentProps(Document document, String title, Properties props) {
document.addTitle(title);
document.addSubject("");
document.addKeywords("pdf, itext");
document.addCreator("OSCAR");
document.addAuthor("");
document.addHeader("Expires", "0");
// A0-A10, LEGAL, LETTER, HALFLETTER, _11x17, LEDGER, NOTE, B0-B5, ARCH_A-ARCH_E, FLSA
// and FLSE
// the following shows a temp way to get a print page size
final String PAGESIZE = "printPageSize";
Rectangle pageSize = PageSize.LETTER;
if ("PageSize.HALFLETTER".equals(props.getProperty(PAGESIZE)))
pageSize = PageSize.HALFLETTER;
if ("PageSize.A6".equals(props.getProperty(PAGESIZE)))
pageSize = PageSize.A6;
document.setPageSize(pageSize);
document.open();
}
示例5: getPageSize
private Rectangle getPageSize(boolean landscape) {
Rectangle pageSize;
if (Locale.US.getCountry().equals(I18N.getCurrentLocale().getCountry())) {
// Letter size paper is used in the US instead of the ISO standard A4
pageSize = PageSize.LETTER;
} else {
pageSize = PageSize.A4;
}
if (landscape) {
pageSize = pageSize.rotate();
}
return pageSize;
}
示例6: printCards
private void printCards(
List<String> triples,
String blanks,
String category,
String fileName,
Random random)
throws FileNotFoundException, DocumentException
{
Document document = new Document(PageSize.LETTER);
Font font = new Font(Font.COURIER, 200);
PdfWriter writer =
PdfWriter.getInstance(document, new FileOutputStream(fileName));
writer.setPageEvent(new PageHandler(fileName));
try
{
document.open();
Paragraph categoryParagraph = new Paragraph(
"From the " + category + " category",
new Font(Font.TIMES_ROMAN, 36));
categoryParagraph.setAlignment(Paragraph.ALIGN_CENTER);
document.add(categoryParagraph);
document.add(new Paragraph(blanks, new Font(Font.COURIER, 50)));
document.newPage();
for (String triple : triples)
{
Paragraph p = new Paragraph(triple, font);
p.setAlignment(Paragraph.ALIGN_CENTER);
document.add(p);
document.newPage();
}
}
finally
{
document.close();
}
}
示例7: writeReportPDF
protected void writeReportPDF(List<CustomerLoadFileResult> fileResults) {
if (fileResults.isEmpty()) {
return;
}
// setup the PDF business
Document pdfDoc = new Document(PageSize.LETTER, 54, 54, 72, 72);
try {
getPdfWriter(pdfDoc);
try {
pdfDoc.open();
if (fileResults.isEmpty()) {
writeFileNameSectionTitle(pdfDoc, "NO DOCUMENTS FOUND TO PROCESS");
return;
}
CustomerLoadResult result;
String customerResultLine;
for (CustomerLoadFileResult fileResult : fileResults) {
// file name title
String fileNameOnly = fileResult.getFilename().toUpperCase();
fileNameOnly = fileNameOnly.substring(fileNameOnly.lastIndexOf("\\") + 1);
writeFileNameSectionTitle(pdfDoc, fileNameOnly);
// write any file-general messages
writeMessageEntryLines(pdfDoc, fileResult.getMessages());
// walk through each customer included in this file
for (String customerName : fileResult.getCustomerNames()) {
result = fileResult.getCustomer(customerName);
// write the customer title
writeCustomerSectionTitle(pdfDoc, customerName.toUpperCase());
// write a success/failure results line for this customer
customerResultLine = result.getResultString() + (ResultCode.SUCCESS.equals(result.getResult()) ? WORKFLOW_DOC_ID_PREFIX + result.getWorkflowDocId() : "");
writeCustomerSectionResult(pdfDoc, customerResultLine);
// write any customer messages
writeMessageEntryLines(pdfDoc, result.getMessages());
}
}
} finally {
if (pdfDoc != null) {
pdfDoc.close();
}
}
}
catch (IOException | DocumentException ex) {
throw new RuntimeException("Could not open file for results report",ex);
}
}