- Активировать лицензию при запуске приложения, в каком -то виде инициализации бобов: < /p>
Код: Выделить всё
LicenseKeyVolumeConfigurer.useLocalReporting(iTextLicenseLocalVolumeReportPath); LicenseKey.loadLicenseFile(iTextLicenseKeyPath); < /code> < /li> В классе службы приложения Java < /p> // Returns byte[] public byte[] createPdf(PdfData pdfData) throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); PdfWriter writer = new PdfWriter(byteArrayOutputStream); PdfDocument pdfDocument = new PdfDocument(writer); Document document = new Document(pdfDocument, PageSize.LETTER, false); //... // Add PDF sections, e.g.: Paragraph paragraphIntro = new Paragraph(String.format(INTRO_PARAGRAPH, StringUtils.defaultIfBlank(pdfData.getSomeStr(), ""))); paragraphIntro.setFont(timesNormalFont); paragraphIntro.setFontSize(BODY_FONT_SIZE); paragraphIntro.setMarginTop(INTRO_PARAGRAPH_MARGIN_TOP); document.add(paragraphIntro); // etc. // ... document.close(); pdfDocument.close(); byte[] result = byteArrayOutputStream.toByteArray(); byteArrayOutputStream.close(); return result; }
Подробнее здесь: https://stackoverflow.com/questions/797 ... al-license