contentStream.setFont(pdfFont, fontSize); contentStream.newLineAtOffset(startX, startY); for (String line: lines)
contentStream.setFont(pdfFont, fontSize); contentStream.moveTextPositionByAmount(startX, startY); for (String line: lines)
contentStream.setFont( PDType1Font.HELVETICA_BOLD , 12 );
contents.setFont(font, 12); contents.newLineAtOffset(100, 700); contents.showText(message);
contents.setFont(font, 12); contents.newLineAtOffset(100, 700); contents.showText(message);
contents.setFont(font, 12); contents.newLineAtOffset(100, 700); contents.showText(message);
contentStream.setFont(font, FONT_SIZE); font = PDTrueTypeFont.load(doc, PDDocument.class.getResourceAsStream( "/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"), WinAnsiEncoding.INSTANCE); contentStream.setFont(font, FONT_SIZE); contentStream.showText(message); font = PDTrueTypeFont.load(doc, PDDocument.class.getResourceAsStream( "/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"), WinAnsiEncoding.INSTANCE); contentStream.setFont(font, FONT_SIZE); contentStream.setWordSpacing(wordSpacing); contentStream.showText(message); font = PDType0Font.load(doc, PDDocument.class.getResourceAsStream( "/org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf")); contentStream.setFont(font, FONT_SIZE); contentStream.setWordSpacing(wordSpacing); contentStream.showText(message);
contents.setFont(font, FONT_SIZE); contents.newLineAtOffset(rectangle.getLowerLeftX() + MARGIN, rectangle.getUpperRightY() - MARGIN);
contentStream.setFont( PDType1Font.HELVETICA_BOLD , 12 );
contents.setFont(font, 12); contents.newLineAtOffset(100, 700); contents.showText(message);
contentStream.setFont( font, 12 ); contentStream.newLineAtOffset(100, 700); contentStream.showText("Go to Document->File Attachments to View Embedded Files");
private static void showPageNo(PDDocument document, PDPage page, String pageText) throws IOException { int fontSize = 10; try (PDPageContentStream contents = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.PREPEND, true)) { float pageWidth = page.getMediaBox().getWidth(); float pageHeight = page.getMediaBox().getHeight(); PDFont font = PDType1Font.HELVETICA; contents.setFont(font, fontSize); float textWidth = font.getStringWidth(pageText) / 1000 * fontSize; contents.beginText(); contents.newLineAtOffset(pageWidth / 2 - textWidth / 2, pageHeight - INCH / 2); contents.showText(pageText); contents.endText(); } } }
contents.setFont(PDType1Font.HELVETICA_BOLD, 12); contents.newLineAtOffset(2, PDRectangle.LETTER.getHeight() - 12); contents.showText("Sample text");
contentStream.setFont(hfont, 20); contentStream.setLeading(25); contentStream.newLineAtOffset(20, 300); contentStream.setFont(hfont, 20); contentStream.newLineAtOffset(20, 650); contentStream.showText("①「あーだこーだ」"); contentStream.setFont(vfont, 20); contentStream.newLineAtOffset(50, 600); contentStream.showText("②「あーだこーだ」"); contentStream.setFont(vfont2, 20); contentStream.newLineAtOffset(100, 600); contentStream.showText("③「あーだこーだ」");
contents.setFont(PDType1Font.HELVETICA, 15); contents.newLineAtOffset(70, PDRectangle.A4.getHeight() - 30 - i * 35); contents.showText(options.get(i));
stream.setFont(font, 12); stream.setLeading(12 * 1.2f);
cs.setFont(font, scale);
contentStream.setFont( font, fontSize );
contentStream.setFont( font, fontSize ); contentStream.beginText(); contentStream.newLineAtOffset(startX, startY);