List of usage examples for org.apache.pdfbox.pdmodel PDPage PDPage
public PDPage()
From source file:Reports.DROTDataReader.java
public void multiPdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;// ww w.j av a2 s .c o m //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastCycle = null; System.out.println("DTL_DATA keyset:" + DROT_DATA.keySet()); System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); System.out.println(cycles); for (String updateDate : DROT_DATA.keySet()) { Map<String, List<String>> thisDTData = DROT_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String cycle : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(cycle)) { PDDocument pdf = new PDDocument(); lastCycle = cycle; List<String> thisCycle = thisDTData.get(cycle); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, cycle, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, cycle, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastCycle, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\DROT UPDT " + updateDate + " " + cycle + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:Reports.DROTDataReader.java
public void singlePdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDDocument pdf = new PDDocument(); PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;//from w ww .j av a 2 s . co m //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastInputSource = null; System.out.println("DROT_DATA keyset:" + DROT_DATA.keySet()); // System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); // System.out.println(cycles); String pdfFileName = pdfFileNameBase + "\\DROT UPDT"; for (String updateDate : DROT_DATA.keySet()) { Map<String, List<String>> thisDTData = DROT_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); pdfFileName = pdfFileName + " " + updateDate; for (String inputSource : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(inputSource)) { //PDDocument pdf = new PDDocument(); lastInputSource = inputSource; List<String> thisCycle = thisDTData.get(inputSource); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, inputSource, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, inputSource, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastInputSource, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); //String pdfFileName = pdfFileNameBase + "\\DROT UPDT " + updateDate + " " + cycle + ".pdf"; } } } if (pdf.getNumberOfPages() > 0) { pdfFileName = pdfFileName + ".pdf"; pdf.save(pdfFileName); } pdf.close(); }
From source file:Reports.DTLDataReader.java
public void PdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;/* w ww . j a v a 2 s. c om*/ //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastCycle = null; System.out.println("DTL_DATA keyset:" + DTL_DATA.keySet()); System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); System.out.println(cycles); for (String updateDate : DTL_DATA.keySet()) { Map<String, List<String>> thisDTData = DTL_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String cycle : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(cycle)) { PDDocument pdf = new PDDocument(); lastCycle = cycle; List<String> thisCycle = thisDTData.get(cycle); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, cycle, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, cycle, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastCycle, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\DTL UPDT " + updateDate + " " + cycle + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:Reports.LeaveDataReader.java
public void multiPdfGenerator(String pdfFileNameBase, Set<String> inputSources) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; System.out.println("passed in " + inputSources); PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;/* ww w . j a v a 2 s. c o m*/ //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastInputSource = null; System.out.println("LEAVE_DATA keyset:" + LEAVE_DATA.keySet()); // System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); // System.out.println(cycles); for (String updateDate : LEAVE_DATA.keySet()) { Map<String, List<String>> thisDTData = LEAVE_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String inputSource : thisDTData.keySet()) { if (inputSources.isEmpty() || inputSources.contains(inputSource)) { PDDocument pdf = new PDDocument(); lastInputSource = inputSource; List<String> thisCycle = thisDTData.get(inputSource); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, lastInputSource, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, lastInputSource, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastInputSource, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\LEAVE UPDT " + updateDate + " " + lastInputSource + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:Reports.LeaveDataReader.java
public void singlePdfGenerator(String pdfFileNameBase, Set<String> inputSources) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; System.out.println("passed in " + inputSources); PDDocument pdf = new PDDocument(); PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;// w ww.j a v a2 s .co m //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastInputSource = null; System.out.println("LEAVE_DATA keyset:" + LEAVE_DATA.keySet()); // System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); // System.out.println(cycles); String pdfFileName = pdfFileNameBase + "\\LEAVE UPDT"; for (String updateDate : LEAVE_DATA.keySet()) { Map<String, List<String>> thisDTData = LEAVE_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); pdfFileName = pdfFileName + " " + updateDate; for (String inputSource : thisDTData.keySet()) { if (inputSources.isEmpty() || inputSources.contains(inputSource)) { lastInputSource = inputSource; List<String> thisCycle = thisDTData.get(inputSource); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, lastInputSource, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, lastInputSource, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastInputSource, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); } } } if (pdf.getNumberOfPages() > 0) { pdfFileName = pdfFileName + ".pdf"; pdf.save(pdfFileName); } pdf.close(); }
From source file:Reports.MgmtNoticesDataReader.java
public void multiPdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;//w ww .j a va 2s .c o m //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastCycle = null; // System.out.println("DROT_DATA keyset:" + MGNT_DATA.keySet()); // System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); // System.out.println(cycles); for (String updateDate : MGNT_DATA.keySet()) { Map<String, List<String>> thisDTData = MGNT_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String cycle : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(cycle)) { PDDocument pdf = new PDDocument(); lastCycle = cycle; List<String> thisCycle = thisDTData.get(cycle); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, cycle, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, cycle, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastCycle, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\MGMT NTC UPDT " + updateDate + " " + cycle + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:Reports.MgmtNoticesDataReader.java
public void singlePdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDDocument pdf = new PDDocument(); PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;/*ww w .j a va 2 s. c o m*/ //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastTrans = null; System.out.println("MGNT_DATA keyset:" + MGNT_DATA.keySet()); // System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); // System.out.println(cycles); String pdfFileName = pdfFileNameBase + "\\MGMT NTC UPDT"; for (String updateDate : MGNT_DATA.keySet()) { Map<String, List<String>> thisDTData = MGNT_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); pdfFileName = pdfFileName + " " + updateDate; for (String trans : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(trans)) { //PDDocument pdf = new PDDocument(); lastTrans = trans; List<String> thisCycle = thisDTData.get(trans); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, trans, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, trans, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; } setupFootNote(stream, pageCount, lastTrans, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); } } } if (pdf.getNumberOfPages() > 0) { pdfFileName = pdfFileName + ".pdf"; pdf.save(pdfFileName); } pdf.close(); }
From source file:Reports.RecycleDataReader.java
public void PdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;/*from w w w . j ava2 s . c o m*/ //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastCycle = null; System.out.println("RECYCLE_DATA keyset:" + RECYCLE_DATA.keySet()); System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); System.out.println(cycles); for (String updateDate : RECYCLE_DATA.keySet()) { Map<String, List<String>> thisDTData = RECYCLE_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String cycle : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(cycle)) { PDDocument pdf = new PDDocument(); lastCycle = cycle; List<String> thisCycle = thisDTData.get(cycle); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, cycle, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, cycle, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastCycle, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\RECYCLE UPDT " + updateDate + " " + cycle + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:Reports.RejectDataReader.java
public void PdfGenerator(String pdfFileNameBase, List<String> cycles) throws IOException, COSVisitorException { GlobalVar.dirMake(new File(pdfFileNameBase)); //create a folder with the same name int rowCount = 0; int pageCount = 1; PDPage page; //default size PAGE_SIZE_A4 PDPageContentStream stream;//ww w. j a v a2 s. c o m //page.setRotation(90); //counterclock wise rotate 90 degree ////left hand rule // stream.setFont(PDType1Font.COURIER, FONT_SIZE); String lastUpdate = null; String lastCycle = null; System.out.println("REJECT_DATA keyset:" + REJECT_DATA.keySet()); System.out.println("Cycles empty? " + cycles.isEmpty() + cycles.size()); System.out.println(cycles); for (String updateDate : REJECT_DATA.keySet()) { Map<String, List<String>> thisDTData = REJECT_DATA.get(updateDate); lastUpdate = updateDate; System.out.println("thisDT_DATA keyset:" + thisDTData.keySet()); for (String cycle : thisDTData.keySet()) { if (cycles.isEmpty() || cycles.contains(cycle)) { PDDocument pdf = new PDDocument(); lastCycle = cycle; List<String> thisCycle = thisDTData.get(cycle); pageCount = 1; // new cycle, restart page num page = new PDPage(); //page break stream = new PDPageContentStream(pdf, page, true, false); stream.beginText(); page.setRotation(PAGE_ROT_DEGREE); //stream.setFont(PDType1Font.COURIER, FONT_SIZE); addBigFontUpdateNumberAndCycle(updateDate, cycle, stream); stream.setFont(PDType1Font.COURIER, FONT_SIZE); // stream.setFont(PDType1Font. int thisCycleRowCount = 0; for (String row : thisCycle) { if (thisCycleRowCount > MAX_NUM_TRANS) { //close the current page setupFootNote(stream, pageCount, cycle, updateDate); pageCount++; stream.endText(); stream.close(); pdf.addPage(page); // start a new page page = new PDPage(); stream = new PDPageContentStream(pdf, page, true, false); page.setRotation(PAGE_ROT_DEGREE); stream.beginText(); stream.setFont(PDType1Font.COURIER, FONT_SIZE); thisCycleRowCount = 0; } stream.setTextRotation(TEXT_ROT_RAD, TRANS_X + thisCycleRowCount * INVERVAL_X, TRANS_Y); stream.drawString(row); thisCycleRowCount++; //System.out.println("Update:" + updateDate + " Cycle: " + cycle + " " + row); } setupFootNote(stream, pageCount, lastCycle, lastUpdate); stream.endText(); stream.close(); pdf.addPage(page); String pdfFileName = pdfFileNameBase + "\\REJECT UPDT " + updateDate + " " + cycle + ".pdf"; pdf.save(pdfFileName); pdf.close(); } } } // pdf.save(pdfFileName); // pdf.close(); }
From source file:ResumeBuilder.PDFTest.java
public void createPdf(String name) throws IOException { try (PDDocument document = new PDDocument()) { PDPage blankPage = new PDPage(); document.addPage(blankPage);//ww w .j a va 2s.c o m document.save(name); } Document doc = new Document(); }