admin管理员组文章数量:1289817
Hi have a Serenity BDD framework and I am trying to convert my index.html report to itextpdf but its not generating the report I have checked the paths and the java class but it not generating , I have added the necessary dependencies in pom.xml and java class
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.2.0</version>
<type>pom</type>
</dependency>
<!-- iText HTML-to-PDF -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>html2pdf</artifactId>
<version>6.1.0</version>
</dependency>````
**The java class added under utils folder-**
import com.itextpdf.html2pdf.HtmlConverter;
import java.io.*;
public class htmltopdf {
public static void main(String[] args) {
try {
// Paths
String htmlFilePath = "target/site/serenity/index.html";
String pdfFilePath = "Serenity-Report.pdf";
// Convert HTML to PDF
HtmlConverter.convertToPdf(new File(htmlFilePath), new File(pdfFilePath));
System.out.println("PDF generated successfully: " + pdfFilePath);
} catch (Exception e) {
e.printStackTrace();
}
}
}
本文标签: javaResult report conversion HTMLtoPDF in SerenityBDD framework using itextpdfStack Overflow
版权声明:本文标题:java - Result report conversion HTMLtoPDF in SerenityBDD framework using itextpdf - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741424331a2377988.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论