Foreword: In the process of merging pictures into pdf, you can use **ImageIO.read()** method, this method will consume a lot of time to read pictures, try to control the time of merging pdf within 1 second 1. Import dependencies <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>fontbox</artifactId> <version>2.0.12</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> <version>2.0.12</version> </dependency> <!– https://mvnrepository.com/artifact/com.itextpdf/itextpdf –> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> […]
Tag: itext
itextpdf generates pdf based on pdf form template filling
itextpdf generates pdf based on pdf form template filling Template creation Example: Create a template using adobe acrobat tools Take excel to generate a form template as an example 1. Create a form excel 2. Create a new PDF form template Open the pdf tool: File -> Create -> Create Form Select the created excel […]
C# Json data to DataTable and generate PDF online download–iTextSharp generates PDF instance (file download, json data conversion, PDF typesetting in one step)
Foreword This article will focus on the use of iTextSharp and some pitfalls that are easy to step on. By the way, it will introduce the simple, fast and efficient method of converting json to DataTable and the method of online instant download of binary stream conversion files. After testing, it only takes 1 second […]
itextpdf, freemarker and flying-saucer-pdf implement PDF export function
Directory Directory 1. Import maven 2. Code structure? Edit 3. Plain text generation method JavaToPdfHtml template.html The simhei.ttf font file is downloaded from Baidu 4. Based on the freemarker template engine JavaToPdfHtmlFreeMarker templateF.html 5. Based on the advanced features of CSS JavaToPdfHtmlFreeMarkerCss templateFCss.html Font files and picture files to download from Baidu calibri.ttf, simsun.ttc, logo.png […]
Use D3 to draw a map while solving the problem that the map coloring fitExtent fails
Using D3 to draw maps First look at the renderings: [External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ENi85nYQ-1678532273754)(null)] First, the data geoJson used by D3 to draw maps can be obtained from the Alibaba Cloud data visualization platform: […]
C# implements keyword signature and stamping through iTextSharp (by inserting stamped pictures in the content)
This function reads the PDF document information through iTextSharp, and searches for each page of the PDF file in a loop. As long as it meets the conditions in the entire PDF, it will be stamped. For example, only the last page needs to be stamped. Please remove the For loop in the method, and […]
[Solved] Solve the Maven error “Cannot resolve com.lowagie:itext:2.1.7.js7”
Maven reports an error when downloading the itext dependency of version 2.1.7.js7: “Cannot resolve com.lowagie:itext:2.1.7.js7” Problem reason: Since the itext dependency of the 2.1.7.js7 version is specified in the pom file of jasperreports, there is no such tape in the current Maven central warehouse or other mirror warehouses. There are suffixed versions such as js7. […]
[Solved] Use jsoup to normalize html itext html to PDF to solve the problem of missing spaces
/** * Normalize html using jsoup * * @param html html content * @return normalized html */ private static String formatHtml(String html) { org.jsoup.nodes.Document doc = Jsoup.parse(html); //Set the export format to keep spaces doc.outputSettings(new org.jsoup.nodes.Document.OutputSettings().prettyPrint(false)); // remove excessive width String style = doc.attr(“style”); if (StringUtils.isNotEmpty(style) & amp; & amp; style.contains(“width”)) { doc.attr(“style”, “”); } […]