Example #1
0
 @SuppressWarnings("unused")
 private void save(PDFDocument doc) {
   try {
     doc.saveAndClose(new FileOutputStream("test.pdf"));
   } catch (FileNotFoundException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Example #2
0
 @Test
 public void testTitlePageWithCovert() {
   Map<String, String> options = new HashMap<String, String>();
   options.put(PDFTitlePage.COVERT_FILE_KEY, coverImage.getAbsolutePath());
   PDFTitlePage page = doc.addTitlePage("This is a title", "and this their subtitle", options);
   boolean fired;
   try {
     page.create();
     fired = false;
   } catch (IOException e) {
     fired = true;
   }
   assertFalse(fired);
 }
Example #3
0
 @Test
 public void testTitleWithProperties() {
   Map<String, String> options = new HashMap<String, String>();
   for (int i = 0; i < 5; i++) {
     options.put("Key " + i, "Property " + i);
   }
   PDFTitlePage page = doc.addTitlePage("This is a title", "and this their subtitle", options);
   boolean fired;
   try {
     page.create();
     fired = false;
   } catch (IOException e) {
     fired = true;
   }
   assertFalse(fired);
 }