Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 474
SGK Avatar asked Dec 04 '25 14:12

SGK


1 Answers

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).

like image 129
Samuel Huylebroeck Avatar answered Dec 08 '25 07:12

Samuel Huylebroeck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!