Merge image in Java

High-speed and cross-platform Java library for merging HTML to image using Java code

使用 Aspose.Slides 將 HTML 合併為圖像

Aspose.Slides for Java is a powerful Java library used to merge and manipulate presentations, HTML docs, and other files. When you merge HTML to image, you are effectively combining the contents in HTML documents to obtain a single image.

Merge HTML to image in Java

Using Aspose.Slides for Java , you can merge image files quickly with just a few lines of code

Java code for merging HTML to image


Presentation pres = new Presentation();
try {
    pres.getSlides().addFromHtml(new StreamReader("file1.html"));
    pres.getSlides().addFromHtml(new StreamReader("file2.html"));

    for (int index = 0; index < pres.getSlides().size(); index++)
    {
        ISlide slide = pres.getSlides().get_Item(index);
        BufferedImage bufferedImage = slide.getThumbnail();
        ImageIO.write(bufferedImage, "PNG", new File("image_java_" + index + ".png"));
    }
} finally {
    if (pres != null) pres.dispose();
}

How to merge HTML to image in Java

  1. 安裝Aspose.Slides for Java。請參閱 安裝

  2. 添加庫作為項目中的引用。

  3. 創建一個 Presentation 類的實例。

  4. 加載要合併在一起的 HTML 文檔。

  5. 保存生成的圖像。

在線合併 PDF 文件

如何在 Python 中合併 PDF

合併其他文件

您還可以合併其他格式的文件以獲得單個文件