HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML Forums › Technical questions / Troubleshooting › Demo Watermark present even with ApiKey?
- This topic has 0 replies, 1 voice, and was last updated Oct 26, 2019
15:05:35 byBurton.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
October 26, 2019 at 15:05#33733
I am having trouble producing PDF’s without the “Demo watermark” appearing. Has anyone experienced this? I have the paid version api key, but the demo watermark appears on some pdfs and not others. I have provided a test file that demonstrates this (and also shows how I’m using the java library). I’m using version 4.0.6fx1-SNAPSHOT. Any help is appreciated.
class PD4MLTest { private static String tempDir = "./"; private static String apiKey = "_api_key_"; private static final String html_showsDemo = "<p><strong>Hello World!</strong></p>"; private static final String html_noDemo = "<p><strong>Hello World!</strong></p><pd4ml:page.break>"; @Test void pdfCreationTest_notWorking() throws Exception { PD4ML pd4ml = new PD4ML(apiKey); pd4ml.setPageSize(PageSize.LETTER); // Convert ByteArrayInputStream bais = new ByteArrayInputStream(html_showsDemo.getBytes(StandardCharsets.UTF_8.name())); ByteArrayOutputStream baos = new ByteArrayOutputStream(); pd4ml.readHTML(bais); pd4ml.writePDF(baos); InputStream is = new ByteArrayInputStream(baos.toByteArray()); String filePath = tempDir + "pdf_test_demo.pdf"; File targetFile = new File(filePath); FileUtils.copyInputStreamToFile(is, targetFile); System.out.println("PDF file created, location: " + filePath); } @Test void pdfCreationTest_working() throws Exception { PD4ML pd4ml = new PD4ML(apiKey); pd4ml.setPageSize(PageSize.LETTER); // Convert ByteArrayInputStream bais = new ByteArrayInputStream(html_noDemo.getBytes(StandardCharsets.UTF_8.name())); ByteArrayOutputStream baos = new ByteArrayOutputStream(); pd4ml.readHTML(bais); pd4ml.writePDF(baos); InputStream is = new ByteArrayInputStream(baos.toByteArray()); String filePath = tempDir + "pdf_test_noDemo.pdf"; File targetFile = new File(filePath); FileUtils.copyInputStreamToFile(is, targetFile); System.out.println("PDF file created, location: " + filePath); } }Attachments:
You must be logged in to view attached files. -
AuthorPosts
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
