contentStream.newLineAtOffset(0, -leading); contentStream.endText(); contentStream.close();
contentStream.moveTextPositionByAmount(0, -leading); contentStream.endText(); contentStream.close();
contentStream.moveTextPositionByAmount(textx,texty); contentStream.drawString(text); contentStream.endText(); textx += colWidth;
private void printMultipleLines( PDPageContentStream contentStream, List<String> lines, float x, float y) throws IOException { if (lines.size() == 0) { return; } final int numberOfLines = lines.size(); final float fontHeight = getFontHeight(); contentStream.beginText(); contentStream.appendRawCommands(fontHeight + " TL\n"); contentStream.moveTextPositionByAmount( x, y); for (int i = 0; i < numberOfLines; i++) { contentStream.drawString(lines.get(i)); if (i < numberOfLines - 1) { contentStream.appendRawCommands("T*\n"); } } contentStream.endText(); }
contentStream.appendRawCommands(" \'\n"); contentStream.endText();
contents.newLineAtOffset(100, 700); contents.showText(message); contents.endText();
contents.newLineAtOffset(100, 700); contents.showText(message); contents.endText();
contents.newLineAtOffset(100, 700); contents.showText(message); contents.endText();
contents.endText();
contentStream.moveTextPositionByAmount(textx,texty); contentStream.drawString(text); contentStream.endText(); textx += colWidth;
contents.newLineAtOffset(100, 700); contents.showText(message); contents.endText();
contentStream.newLineAtOffset(100, 700); contentStream.showText("Go to Document->File Attachments to View Embedded Files"); contentStream.endText();
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.newLineAtOffset(2, PDRectangle.LETTER.getHeight() - 12); contents.showText("Sample text"); contents.endText();
contentStream.newLine(); contentStream.showText("③ Vertical without substitution"); contentStream.endText(); contentStream.newLineAtOffset(20, 650); contentStream.showText("①「あーだこーだ」"); contentStream.endText(); contentStream.newLineAtOffset(50, 600); contentStream.showText("②「あーだこーだ」"); contentStream.endText(); contentStream.newLineAtOffset(100, 600); contentStream.showText("③「あーだこーだ」"); contentStream.endText();
contents.newLineAtOffset(70, PDRectangle.A4.getHeight() - 30 - i * 35); contents.showText(options.get(i)); contents.endText();
stream.endText();
contentStream.endText();
contentStream.newLineAtOffset(100, 100); contentStream.showText(message); contentStream.endText();