Merge image in Java

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

Slå samman HTML till bild med Aspose.Slides

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. Installera Aspose.Slides för Java. Se Installation .

  2. Lägg till biblioteket som referens i ditt projekt.

  3. Skapa en instans av klassen Presentation.

  4. Ladda HTML-dokumenten som du vill slå samman.

  5. Spara den resulterande bilden.

Slå samman PDF-filer online

Hur man sammanfogar PDF i Python

Slå ihop andra filer

Du kan också kombinera filer i andra format för att få en enda fil