java - how to add image or Logo in pdf Using Html Worker for Saving Html to Pdf in Jsp -


import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.outputstream; import java.io.stringreader; import com.itextpdf.text.document; import com.itextpdf.text.documentexception; import com.itextpdf.text.html.simpleparser.htmlworker; import com.itextpdf.text.pdf.pdfwriter; public class myclass {     public static void main(string[] args) {         string result = "<html><body><div>(i) recognised association shall have approval of forward  markets  commission established under forward  contracts (regulation) act, 1952 (74 of 1952) in respect of trading in derivatives , shall function in accordance guidelines or conditions laid down forward  markets  commission; </div>  <body> </html>";         try {             outputstream file = new fileoutputstream(new file("e:\\test.pdf"));             document document = new document();             pdfwriter.getinstance(document, file);             document.open();             @suppresswarnings("deprecation")             htmlworker htmlworker = new htmlworker(document);             htmlworker.parse(new stringreader(result));             document.close();             file.flush();         } catch (filenotfoundexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (documentexception e) {             // todo auto-generated catch block             e.printstacktrace();         } catch (ioexception e) {             // todo auto-generated catch block             e.printstacktrace();         }      } } 

this code to save html pdf using itext , html worker able convert html file pdf need add on static image{logo} in pdf on top of pdf mean if first logo image text should appear please me unable this..

i thing practice use itext pdf manipulations, don't think html worker enough need. see this image pdf related tutorials..


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -