• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PDPageContentStream类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.pdfbox.pdmodel.edit.PDPageContentStream的典型用法代码示例。如果您正苦于以下问题:Java PDPageContentStream类的具体用法?Java PDPageContentStream怎么用?Java PDPageContentStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PDPageContentStream类属于org.apache.pdfbox.pdmodel.edit包,在下文中一共展示了PDPageContentStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: create100Pages

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
public PDDocument create100Pages() throws IOException
{
    PDDocument document = new PDDocument();
    
    for (int i = 0; i < 100; i++)
    {
        PDPage page = new PDPage();
        document.addPage(page);
        PDPageContentStream content = new PDPageContentStream(document, page);
        content.beginText();
        content.setFont(PDType1Font.HELVETICA_BOLD, 100);
        content.moveTextPositionByAmount(100, 300);
        content.drawString(String.format("-%s-", i + 1));
        content.endText();
        content.close();
    }
    
    return document;
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:20,代码来源:InsertPages.java


示例2: openContentStream

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
private PDPageContentStream openContentStream(PDPage page, boolean setPageSize, boolean applyPageOrientation) throws IOException {
	contentStream = new PDPageContentStream(doc, page, true, false);
	if (painter != null) {
		PDRectangle pageSize = page.findMediaBox();
		if (PageOrientation.LANDSCAPE.equals(painter.getPageOrientation())) {
			if (setPageSize) {
				painter.setPageHeight(pageSize.getWidth());
				painter.setPageWidth(pageSize.getHeight());
			}
			if (applyPageOrientation) {
				contentStream.concatenate2CTM(0, 1, -1, 0, pageSize.getWidth(), 0); // cos(theta) sin(theta) -sin(theta) cos(theta) 0 0 cm
			}
		} else {
			if (setPageSize) {
				painter.setPageHeight(pageSize.getHeight());
				painter.setPageWidth(pageSize.getWidth());
			}
		}
	}
	return contentStream;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:22,代码来源:PDFImprinter.java


示例3: test

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Test
public void test() throws IOException, COSVisitorException {

	PDDocument doc = new PDDocument();
	PDPage page = new PDPage();
	doc.addPage(page);
	PDPageContentStream contentStream = new PDPageContentStream(doc, page);

	String[][] content = { { "Team", "Captain" },
			{ "Hull City", "Robert Koren" },
			{ "Aston Villa", "Ron Vlaar" },
			{ "Manchester United", "Nemanja Vidic" },
			{ "Manchester City", "Vincent Kompany" } };

	drawTable(page, contentStream, 700, 100, content);

	contentStream.close();
	Path outputFilePath = Files.createTempFile("Test-CaptainTeam-Table", ".pdf");
	doc.save(outputFilePath.toFile());
	logger.info("test# "+ outputFilePath.toAbsolutePath().toString());

}
 
开发者ID:rmohta,项目名称:pdfboxExamples,代码行数:23,代码来源:PdfTable.java


示例4: createTestDocument

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
byte[] createTestDocument() throws IOException, COSVisitorException
{
    try (   ByteArrayOutputStream baos = new ByteArrayOutputStream();
            PDDocument doc = new PDDocument()   )
    {
        PDPage page = new PDPage(new PDRectangle(792, 612));
        doc.addPage(page);
        
        PDFont font = PDType1Font.COURIER;

        PDPageContentStream contents = new PDPageContentStream(doc, page);
        contents.beginText();
        contents.setFont(font, 9);
        contents.moveTextPositionByAmount(100, 500);
        contents.drawString("             2                                                                  Netto        5,00 EUR 3,00");
        contents.moveTextPositionByAmount(0, 0);
        contents.drawString("                2882892  ENERGIZE LR6 Industrial                     2,50 EUR 1");
        contents.endText();
        contents.close();
        
        doc.save(baos);
        
        return baos.toByteArray();
    }
}
 
开发者ID:mkl-public,项目名称:testarea-pdfbox1,代码行数:26,代码来源:ExtractWithoutExtraSpaces.java


示例5: writeImageToPDF

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
private void writeImageToPDF(PDJpeg img, int c, int size) throws IOException {
	PDPageContentStream cs = new PDPageContentStream(document, page, true, false);
				
	float x = getLeftX();
	float y = page.getYCursor()-img.getHeight();

	if (c>0&&(c%2==0)) {
		x+=350;
	}
	
	if (size > 0) {
		y = page.getYCursor()-400;
	}
	if (isFullPage())
		  y = page.getLowY();
		cs.drawImage(img, x, y);
 		cs.close();
}
 
开发者ID:purbon,项目名称:pdfwriter,代码行数:19,代码来源:PDFChart.java


示例6: create

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
public void create(PDDocument document, PDFPage page) throws IOException {

	PDPageContentStream cs = new PDPageContentStream(document, page, true, false);
       
	PDRectangle pageSize = page.getBleedBox();
       float pageWidth = pageSize.getWidth();
       page.translateAndRotateIfNecessary(cs, pageWidth, 0);
       
	cs.beginText();
	PDFont font = PDType1Font.HELVETICA_BOLD;
	cs.setFont(font, 20);
	cs.moveTextPositionByAmount(page.getLeftX(), page.getTopY());
	cs.drawString(title);
	cs.endText();
	cs.drawLine(page.getLeftX(), page.getTopY()-height, page.getRightX(), page.getTopY()-height);
		cs.close();
}
 
开发者ID:purbon,项目名称:pdfwriter,代码行数:18,代码来源:PageHeader.java


示例7: addTitleRow

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
public void addTitleRow(String[] titles) throws IOException {
	if (hideTable)
		return;
	int size = 16;
	float cellSize = (getWidth()/titles.length);
	PDFont font = PDType1Font.HELVETICA_BOLD;
	PDPageContentStream cs = new PDPageContentStream(document, page, true, 	false);
	cs.setFont(font, size);
	float leftX = getLeftX()+30;

	for (String title : titles) {
		cs.beginText();
		cs.moveTextPositionByAmount(leftX, page.getYCursor());
		cs.drawString(title);
		cs.endText();
		if (cellSize != -1)
			leftX += cellSize;
		else
			leftX += (font.getStringWidth(title) / 1000 * size)+5;
	}
	cs.drawLine(getLeftX(), page.getYCursor() - 5, getRightX(), page.getYCursor() - 5);
	cs.close();
	
	scrolldown();
}
 
开发者ID:purbon,项目名称:pdfwriter,代码行数:26,代码来源:PDFTable.java


示例8: checkPDFTemplateFileName

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
private static String checkPDFTemplateFileName(String PDFTemplateFileName, String path) throws IOException, IllegalArgumentException {
	String template;
	if (PDFTemplateFileName != null && PDFTemplateFileName.length() > 0) {
		File file = new File(PDFTemplateFileName);
		if (file.exists()) {
			if (file.isFile()) {
				if (file.canRead()) {
					PDDocument doc = null;
					try {
						doc = PDDocument.load(file);
						PDPage page = (PDPage) doc.getDocumentCatalog().getAllPages().get(0);
						PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true);
						contentStream.close();
						template = file.getCanonicalPath();
					} catch (Exception e) {
						throw new IllegalArgumentException(L10nUtil.getMessage(MessageCodes.PDF_TEMPLATE_FILE_INVALID_PDF_ERROR,
								DefaultMessages.PDF_TEMPLATE_FILE_INVALID_PDF_ERROR, PDFTemplateFileName), e);
					} finally {
						if (doc != null) {
							doc.close();
						}
					}
				} else {
					throw new IllegalArgumentException(L10nUtil.getMessage(MessageCodes.PDF_TEMPLATE_FILE_ACCESS_ERROR, DefaultMessages.PDF_TEMPLATE_FILE_ACCESS_ERROR,
							PDFTemplateFileName));
				}
			} else {
				throw new IllegalArgumentException(L10nUtil.getMessage(MessageCodes.PDF_TEMPLATE_FILE_NOTAFILE_ERROR, DefaultMessages.PDF_TEMPLATE_FILE_NOTAFILE_ERROR,
						PDFTemplateFileName));
			}
		} else {
			throw new IllegalArgumentException(L10nUtil.getMessage(MessageCodes.PDF_TEMPLATE_FILE_DOES_NOT_EXIST_ERROR, DefaultMessages.PDF_TEMPLATE_FILE_DOES_NOT_EXIST_ERROR,
					PDFTemplateFileName));
		}
	} else {
		template = "";
	}
	return template;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:40,代码来源:Settings.java


示例9: drawBlock

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
private void drawBlock(PDPageContentStream contentStream,EcrfPDFBlock block ) throws Exception {
	if (// BlockType.NEW_LIST_ENTRY.equals(block.getType())
			BlockType.NEW_ECRF.equals(block.getType())) {
		// || BlockType.ECRF_SIGNATURE.equals(block.getType())) {
		cursor.setSectionY(cursor.getBlockY());
		cursor.setIndexY(cursor.getBlockY());
	} else if (BlockType.NEW_SECTION.equals(block.getType())) {
		cursor.setSectionY(cursor.getBlockY());
		cursor.setIndexY(cursor.getBlockY());
	} else if (BlockType.NEW_INDEX.equals(block.getType())) {
		cursor.setIndexY(cursor.getBlockY());
	}
	cursor.setBlocks(block);
	cursor.setBlockY(cursor.getBlockY() - block.renderBlock(contentStream, cursor));

}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:17,代码来源:EcrfPDFPainter.java


示例10: drawPageBreakNewPage

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
public void drawPageBreakNewPage(PDPageContentStream contentStream) throws Exception {
	EcrfPDFBlock block = blocks.get(blockIndex);

	if (BlockType.INPUT_FIELD.equals(block.getType())
			|| BlockType.AUDIT_TRAIL_VALUE.equals(block.getType())
			|| BlockType.FIELD_STATUS_ENTRY.equals(block.getType())
			|| BlockType.NEW_SECTION.equals(block.getType())
			|| BlockType.NEW_INDEX.equals(block.getType())) {
		// paint ecrf header again
		drawBlock(contentStream, new EcrfPDFBlock(cursor.getEcrfBlock(), true));
	}
	if (BlockType.INPUT_FIELD.equals(block.getType())
			|| BlockType.AUDIT_TRAIL_VALUE.equals(block.getType())
			|| BlockType.FIELD_STATUS_ENTRY.equals(block.getType())) {
		// start section+index again
		drawBlock(contentStream, new EcrfPDFBlock(cursor.getSectionBlock(), true));
		drawBlock(contentStream, new EcrfPDFBlock(cursor.getIndexBlock(), true));
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:20,代码来源:EcrfPDFPainter.java


示例11: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	PDFUtil.renderTextLine(
			contentStream,
			fontA,
			PDFUtil.FontSize.TINY,
			Settings.getColor(ProbandLetterPDFSettingCodes.TEXT_COLOR, Bundle.PROBAND_LETTER_PDF, ProbandLetterPDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getProbandLetterPDFLabel(Locales.PROBAND_LETTER_PDF, ProbandLetterPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(ProbandLetterPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LETTER_PDF, ProbandLetterPDFDefaultSettings.PAGE_LEFT_MARGIN)
			+ (pageWidth
					- Settings.getFloat(ProbandLetterPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LETTER_PDF, ProbandLetterPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings
					.getFloat(ProbandLetterPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.PROBAND_LETTER_PDF, ProbandLetterPDFDefaultSettings.PAGE_RIGHT_MARGIN)) / 2.0f,
					Settings.getFloat(ProbandLetterPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.PROBAND_LETTER_PDF, ProbandLetterPDFDefaultSettings.PAGE_LOWER_MARGIN),
					PDFUtil.Alignment.BOTTOM_CENTER);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:18,代码来源:ProbandLetterPDFPainter.java


示例12: drawPage

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
public void drawPage(PDPageContentStream contentStream) throws Exception {
	// PDFUtil.renderFrame(contentStream, FRAME_COLOR, Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN),
	// Settings.getFloat(CVPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LOWER_MARGIN), pageWidth -
	// Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings.getFloat(CVPDFSettingCodes.PAGE_RIGHT_MARGIN,
	// Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_RIGHT_MARGIN), pageHeight - PAGE_UPPER_MARGIN - Settings.getFloat(CVPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.CV_PDF,
	// CVPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_LEFT, PAGE_FRAME_LINE_WIDTH);

	if (cursor.getStaff() != null) {
		// CVPDFBlock block = blocks.get(blockIndex - 1);
		PDFUtil.renderTextLine(
				contentStream,
				fontA,
				PDFUtil.FontSize.TINY,
				Settings.getColor(CVPDFSettingCodes.TEXT_COLOR, Bundle.CV_PDF, CVPDFDefaultSettings.TEXT_COLOR),
				L10nUtil.getCVPDFLabel(Locales.CV_PDF, CVPDFLabelCodes.FOOTER_NAME, "", cursor.getStaff().getNameWithTitles()),
				Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN),
				Settings.getFloat(CVPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_LEFT);
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:21,代码来源:CVPDFPainter.java


示例13: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	// PDFUtil.renderTextLine(
	// contentStream,
	// fontA,
	// PDFUtil.FontSize.TINY,
	// Settings.getColor(CVPDFSettingCodes.TEXT_COLOR, Bundle.CV_PDF, CVPDFDefaultSettings.TEXT_COLOR),
	// L10nUtil.getCVPDFLabel(Locales.CV_PDF, CVPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
	// Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN)
	// + (pageWidth - Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings.getFloat(
	// CVPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_RIGHT_MARGIN)) / 2.0f,
	// Settings.getFloat(CVPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_CENTER);

	PDFUtil.renderTextLine(
			contentStream,
			fontA,
			PDFUtil.FontSize.TINY,
			Settings.getColor(CVPDFSettingCodes.TEXT_COLOR, Bundle.CV_PDF, CVPDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getCVPDFLabel(Locales.CV_PDF, CVPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN)
					+ (pageWidth - Settings.getFloat(CVPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings.getFloat(
							CVPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_RIGHT_MARGIN)),
					Settings.getFloat(CVPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.CV_PDF, CVPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_RIGHT);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:27,代码来源:CVPDFPainter.java


示例14: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	PDFUtil.renderTextLine(
			contentStream,
			fontA,
			PDFUtil.FontSize.TINY,
			Settings.getColor(CourseCertificatePDFSettingCodes.TEXT_COLOR, Bundle.COURSE_CERTIFICATE_PDF, CourseCertificatePDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getCourseCertificatePDFLabel(Locales.COURSE_CERTIFICATE_PDF, CourseCertificatePDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(CourseCertificatePDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.COURSE_CERTIFICATE_PDF, CourseCertificatePDFDefaultSettings.PAGE_LEFT_MARGIN)
			+ (pageWidth
					- Settings.getFloat(CourseCertificatePDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.COURSE_CERTIFICATE_PDF,
							CourseCertificatePDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings.getFloat(CourseCertificatePDFSettingCodes.PAGE_RIGHT_MARGIN,
									Bundle.COURSE_CERTIFICATE_PDF, CourseCertificatePDFDefaultSettings.PAGE_RIGHT_MARGIN)) / 2.0f,
									Settings.getFloat(CourseCertificatePDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.COURSE_CERTIFICATE_PDF, CourseCertificatePDFDefaultSettings.PAGE_LOWER_MARGIN),
									PDFUtil.Alignment.BOTTOM_CENTER);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:19,代码来源:CourseCertificatePDFPainter.java


示例15: drawPageBreakOldPage

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
public void drawPageBreakOldPage(PDPageContentStream contentStream) throws Exception {
	ReimbursementsPDFBlock block = blocks.get(blockIndex - 1);
	// if (BlockType.NEW_INDEX.equals(block.getType())) {
	// (new EcrfPDFBlock(BlockType.END_OF_SECTION)).renderBlock(contentStream, cursor);
	// } else
	if (BlockType.PAYMENT_METHOD_TABLE_ROW.equals(block.getType())
			|| BlockType.BANK_ACCOUNT_TABLE_ROW.equals(block.getType())) {
		if (!block.isLastTableRow()) {
			PDFUtil.renderLine(contentStream, Settings.getColor(ReimbursementsPDFSettingCodes.PAYMENT_TABLE_FRAME_COLOR, Bundle.REIMBURSEMENTS_PDF,
					ReimbursementsPDFDefaultSettings.PAYMENT_TABLE_FRAME_COLOR), cursor.getBlockX(), cursor.getBlockY(),// - height,
					cursor.getBlockX() + cursor.getBlockWidth(), cursor.getBlockY(),// - height, // height,
					// PDFUtil.Alignment.TOP_LEFT,
					Settings.getFloat(ReimbursementsPDFSettingCodes.PAYMENT_TABLE_BLOCK_FRAME_LINE_WIDTH, Bundle.REIMBURSEMENTS_PDF,
							ReimbursementsPDFDefaultSettings.PAYMENT_TABLE_BLOCK_FRAME_LINE_WIDTH));
		}
	}
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:18,代码来源:ReimbursementsPDFPainter.java


示例16: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	PDFUtil.renderTextLine(
			contentStream,
			fontD,
			PDFUtil.FontSize.TINY,
			Settings.getColor(ReimbursementsPDFSettingCodes.TEXT_COLOR, Bundle.REIMBURSEMENTS_PDF, ReimbursementsPDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getReimbursementsPDFLabel(Locales.REIMBURSEMENTS_PDF, ReimbursementsPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(ReimbursementsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.REIMBURSEMENTS_PDF, ReimbursementsPDFDefaultSettings.PAGE_LEFT_MARGIN)
			+ (pageWidth
					- Settings.getFloat(ReimbursementsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.REIMBURSEMENTS_PDF, ReimbursementsPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings
					.getFloat(ReimbursementsPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.REIMBURSEMENTS_PDF, ReimbursementsPDFDefaultSettings.PAGE_RIGHT_MARGIN))
					/ 2.0f,
					Settings.getFloat(ReimbursementsPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.REIMBURSEMENTS_PDF, ReimbursementsPDFDefaultSettings.PAGE_LOWER_MARGIN),
					PDFUtil.Alignment.BOTTOM_CENTER);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:19,代码来源:ReimbursementsPDFPainter.java


示例17: drawPage

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
public void drawPage(PDPageContentStream contentStream) throws Exception {
	if (cursor.getListEntryBlock() != null) {
		(new ProbandListEntryTagsPDFBlock(cursor.getListEntryBlock(), BlockType.PAGE_TITLE, true)).renderBlock(contentStream, cursor);
	}
	// PDFUtil.renderFrame(contentStream, FRAME_COLOR, Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF,
	// ProbandListEntryTagsPDFDefaultSettings.PAGE_LEFT_MARGIN),
	// Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF, ProbandListEntryTagsPDFDefaultSettings.PAGE_LOWER_MARGIN),
	// pageWidth -
	// Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF, ProbandListEntryTagsPDFDefaultSettings.PAGE_LEFT_MARGIN) -
	// Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_RIGHT_MARGIN,
	// Bundle.PROBAND_LIST_ENTRY_TAGS_PDF, ProbandListEntryTagsPDFDefaultSettings.PAGE_RIGHT_MARGIN), pageHeight - PAGE_UPPER_MARGIN -
	// Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LOWER_MARGIN,
	// Bundle.PROBAND_LIST_ENTRY_TAGS_PDF,
	// ProbandListEntryTagsPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_LEFT, PAGE_FRAME_LINE_WIDTH);
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:17,代码来源:ProbandListEntryTagsPDFPainter.java


示例18: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	PDFUtil.renderTextLine(
			contentStream,
			fontA,
			PDFUtil.FontSize.TINY,
			Settings.getColor(ProbandListEntryTagsPDFSettingCodes.TEXT_COLOR, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF, ProbandListEntryTagsPDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getProbandListEntryTagsPDFLabel(Locales.PROBAND_LIST_ENTRY_TAGS_PDF, EcrfPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF, ProbandListEntryTagsPDFDefaultSettings.PAGE_LEFT_MARGIN)
			+ (pageWidth
					- Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF,
							ProbandListEntryTagsPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings
							.getFloat(
									ProbandListEntryTagsPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF,
									ProbandListEntryTagsPDFDefaultSettings.PAGE_RIGHT_MARGIN)) / 2.0f,
									Settings.getFloat(ProbandListEntryTagsPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.PROBAND_LIST_ENTRY_TAGS_PDF,
											ProbandListEntryTagsPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_CENTER);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:21,代码来源:ProbandListEntryTagsPDFPainter.java


示例19: renderTextValue

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
private float renderTextValue(float x, float y, InputFieldType fieldType, PDPageContentStream contentStream, InputFieldPDFBlockCursor cursor) throws Exception {
	float width = cursor.getBlockIndentedX() + cursor.getBlockIndentedWidth() - x - getXFrameIndent();
	float height = Math.max(PDFUtil.renderMultilineText(
			contentStream,
			cursor.getFontB(),
			PDFUtil.FontSize.MEDIUM,
			isPreset() || blank ? getPresetTextColor() : getTextColor(),
					getTextValue(blank),
					x,
					y,
					PDFUtil.Alignment.TOP_LEFT,
					width), InputFieldType.MULTI_LINE_TEXT.equals(fieldType) ? getMultiLineTextMinHeight() : 0.0f);
	PDFUtil.renderFrame(contentStream, getFrameColor(),
			x - getXValueFrameIndent(),
			y + getYValueFrameIndent(),
			width + 2.0f * getXValueFrameIndent(),
			height + 2.0f * getYValueFrameIndent(),
			PDFUtil.Alignment.TOP_LEFT, getValueFrameLineWidth());
	return height;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:21,代码来源:InputFieldPDFBlock.java


示例20: drawPageNumber

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入依赖的package包/类
@Override
protected void drawPageNumber(PDFImprinter writer, PDPage page, int pageNumber, int totalPages) throws IOException {
	PDPageContentStream contentStream = writer.openContentStream(page);
	PDFUtil.renderTextLine(
			contentStream,
			fontA,
			PDFUtil.FontSize.TINY,
			Settings.getColor(InquiriesPDFSettingCodes.TEXT_COLOR, Bundle.INQUIRIES_PDF, InquiriesPDFDefaultSettings.TEXT_COLOR),
			L10nUtil.getInquiriesPDFLabel(Locales.INQUIRIES_PDF, EcrfPDFLabelCodes.PAGE_NUMBER, "", pageNumber, totalPages),
			Settings.getFloat(InquiriesPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.INQUIRIES_PDF, InquiriesPDFDefaultSettings.PAGE_LEFT_MARGIN)
			+ (pageWidth - Settings.getFloat(InquiriesPDFSettingCodes.PAGE_LEFT_MARGIN, Bundle.INQUIRIES_PDF, InquiriesPDFDefaultSettings.PAGE_LEFT_MARGIN) - Settings
					.getFloat(
							InquiriesPDFSettingCodes.PAGE_RIGHT_MARGIN, Bundle.INQUIRIES_PDF, InquiriesPDFDefaultSettings.PAGE_RIGHT_MARGIN)) / 2.0f,
							Settings.getFloat(InquiriesPDFSettingCodes.PAGE_LOWER_MARGIN, Bundle.INQUIRIES_PDF, InquiriesPDFDefaultSettings.PAGE_LOWER_MARGIN), PDFUtil.Alignment.BOTTOM_CENTER);
	writer.closeContentStream();
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:17,代码来源:InquiriesPDFPainter.java



注:本文中的org.apache.pdfbox.pdmodel.edit.PDPageContentStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProgressSource类代码示例发布时间:2022-05-21
下一篇:
Java XPathNSResolver类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap