Browsed by
Tag: iText

[Solved] The entity “le” was referenced, but not declared.’ itext pdf

[Solved] The entity “le” was referenced, but not declared.’ itext pdf

[Solved] The entity “le” was referenced, but not declared.’ Issue: If you used ≤ then you will get this issue. Solution: You have to actually use <=, currently it does not support ≤ this can be done as <= Hope this helps! 234 total views, no views today

234 total views, no views today

Convert Pdf to Word in Java Example

Convert Pdf to Word in Java Example

Convert Pdf to Word in Java: Required Jars: 1. itextpdf-5.4.4 2. xmlbeans-xpath-2.3.0 3. xmlbeans-2.6.0 4. poi-3.9 5. dom4j-1.6.1 6. poi-ooxml-schemas-3.7 7. poi-ooxml-3.7 Java Program: package in.javadomain; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.xwpf.usermodel.BreakType; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.parser.PdfReaderContentParser; import com.itextpdf.text.pdf.parser.SimpleTextExtractionStrategy; import com.itextpdf.text.pdf.parser.TextExtractionStrategy; public class ConvertPdf2Word { public static void main(String[] args) throws IOException { System.out.println("Document converted started"); XWPFDocument doc = new XWPFDocument(); String pdf = "D:\\javadomain.pdf"; PdfReader reader = new PdfReader(pdf); PdfReaderContentParser parser = new PdfReaderContentParser(reader);…

Read More Read More

6,791 total views, no views today

Xml to Pdf in java using iText Sample code

Xml to Pdf in java using iText Sample code

Xml to Pdf: We can convert any xml file to pdf in java using iText lib. Required Jar Files: Xml to Pdf Required Jars Xml File: <?xml version="1.0"?> <XMLtoPDF> <Friend> <FriendName>Hemakumar</FriendName> <FriendPlace>Arcot</FriendPlace> </Friend> <Friend> <FriendName>Chudar</FriendName> <FriendPlace>Vellore</FriendPlace> </Friend> <Friend> <FriendName>Selva kumar</FriendName> <FriendPlace>Arcot</FriendPlace> </Friend> </XMLtoPDF> Xsl File (stylesheet for the above xml): <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method=’html’ version=’1.0′ encoding=’UTF-8′ indent=’yes’/> <xsl:template match="/"> <html> <body> <h2>Xml 2 Pdf in Java Using iText</h2> <table border="1"> <tr bgcolor="skyblue"> <th align="left">Friend’s Name</th> <th…

Read More Read More

4,950 total views, 1 views today

Html to Pdf in Java using iText

Html to Pdf in Java using iText

Required Jar filess: Html to Pdf Required Jar Files Program: package in.javadomain; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import org.xhtmlrenderer.pdf.ITextRenderer; import com.lowagie.text.DocumentException; public class Html2Pdf { public static void main(String[] args) throws IOException, DocumentException { // Specify the input html file location String htmlInputFileUrl = "D:\\javadomain.html"; String url = new File(htmlInputFileUrl).toURI().toURL().toString(); // specify the output pdf file location String htmlToPdf = "D:\\Javadomain.pdf"; System.out.println("Pdf file created successfully in "+url); OutputStream os = new FileOutputStream(htmlToPdf); ITextRenderer renderer = new ITextRenderer();…

Read More Read More

702 total views, no views today