Java: Converting HTML to PDF

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2022
  • In this video, we will see how to convert an html document to the pdf format. We will create a simple java maven project and using the JSoup and openpdf dependencies convert an input html to pdf.
    You can find the source code at the following github url:
    github.com/chargeahead/html2p...

ความคิดเห็น • 7

  • @ruansilvask
    @ruansilvask ปีที่แล้ว

    Very cool

  • @shrey007sshikhare4
    @shrey007sshikhare4 20 วันที่ผ่านมา

    is it possible to generate pdf from html template dynamically? so the html template will be fixed and based on it will generate multiple pdf (if we have multiple data)

  • @only-codes
    @only-codes ปีที่แล้ว +1

    how to remove the margin and the padding in the generated pdf?

  • @navjotsingh2457
    @navjotsingh2457 ปีที่แล้ว

    Cool

  • @himanshujain9933
    @himanshujain9933 9 หลายเดือนก่อน +1

    CSS is not applied in generated pdf

  • @nguyenquangha2710
    @nguyenquangha2710 ปีที่แล้ว

    mày lừa tao à

  • @milindjadhav4506
    @milindjadhav4506 10 หลายเดือนก่อน

    Exception in thread "main" org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using TrAX transformer). org.xml.sax.SAXParseException; lineNumber: 128; columnNumber: 41; The entity name must immediately follow the '&' in the entity reference.
    at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.transform(XMLResource.java:222)
    at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:181)
    at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:84)
    at org.xhtmlrenderer.pdf.ITextRenderer.setDocumentFromString(ITextRenderer.java:171)
    at Testing_Purpose.H2P.main(H2P.java:30)
    Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException; lineNumber: 128; columnNumber: 41; The entity name must immediately follow the '&' in the entity reference.
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:792)
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:395)
    at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.transform(XMLResource.java:220)
    ... 4 more
    Caused by: org.xml.sax.SAXParseException; lineNumber: 128; columnNumber: 41; The entity name must immediately follow the '&' in the entity reference.
    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1251)
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:693)
    at java.xml/com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:780)
    ... 6 more
    why this happing error?