Exemple #1
0
 internal static PDDocument AddTrialStampIfNecessary(PDDocument pdfFile, bool addJavaScript)
 {
     if (PDFHelper.AddStamp)
     {
         PDFont pDFont = PDTrueTypeFont.load(pdfFile, new java.io.File("C:\\Windows\\Fonts\\Arial.ttf"), new WinAnsiEncoding());
         foreach (PDPage page in pdfFile.getPages())
         {
             PDPageContentStream pDPageContentStream = new PDPageContentStream(pdfFile, page, PDPageContentStream.AppendMode.APPEND, true);
             pDPageContentStream.setFont(pDFont, 14f);
             pDPageContentStream.beginText();
             pDPageContentStream.newLineAtOffset(100f, page.getMediaBox().getHeight() - 100f);
             pDPageContentStream.showText("Created with a trial copy of Aquaforest PDF Toolkit");
             pDPageContentStream.endText();
             pDPageContentStream.close();
         }
     }
     return(pdfFile);
 }