Search code examples
altpage-breakhtml2pdfitext7

Page Break and Alt Tag not working in Itext7 html2pdf


I am trying the sample code as explained in the documentation page

http://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-accessible-pdf-creation

However, when i generate pdf, The alt tags are not set and hence pdf accessibility checker complains. I also found out that page break does't work from the given sample html page. Can someone help me to solve these two issues? My POM.xml has the following dependencies. I have created the exact files and copied the code as mentioned in the above article.

<dependency>
  <groupId>com.itextpdf</groupId>
  <artifactId>itext7-core</artifactId>
  <version>7.0.2</version>
  <type>pom</type>
</dependency>

<dependency>
  <groupId>com.itextpdf</groupId>
  <artifactId>html2pdf</artifactId>
  <version>1.0.0</version>
 </dependency>

<repository>
   <id>itext</id>
   <name>iText Repository - releases</name>
   <url>https://repo.itextsupport.com/releases</url>
</repository>

Thanks

SGK


Solution

  • Support for the page-break-after CSS property has been added in pdfHTML v1.0.1

    The absence of the /alt tags was a bug in v1.0.0 and is fixed in v1.0.1

    (Posting this as answer for the sake of visibility, since this question has popped up here and there before).