# Merge PDF Files and Save as HTML Using Python

> Merge multiple PDF files in Python and export the combined pages as a single HTML5 document.

Source: https://products.aspose.com/slides/python-net/merge/pdf-to-html/
Updated: 2026-07-28



## Merge PDF to HTML in Python

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you combine PDF files by importing their pages into a `Presentation`. `SlideCollection.add_from_pdf` converts each PDF page into a slide and appends it to the presentation. After importing all source files, call `Presentation.save` with `SaveFormat.HTML5` to export the combined content as a single HTML5 document.

## Merge PDF Files to HTML Using Python

Create a presentation without its default blank slide, import the source PDF files in the required order, and export the combined slides as a single HTML5 document.

### Python code for merging PDF files into a single HTML5 document

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document1.pdf")
    presentation.slides.add_from_pdf("document2.pdf")

    presentation.save("merged.html", slides.export.SaveFormat.HTML5)
```

## How to Merge PDF Files and Save as HTML with Aspose.Slides for Python

Follow these steps to merge two PDF files and export the combined pages as a single HTML5 document.

Install Aspose.Slides for Python via .NET by following the [installation guide](https://docs.aspose.com/slides/python-net/installation/).
```console
pip install aspose-slides
```

Make the `aspose.slides` namespace available in your Python project.

Create a `Presentation` and remove its default blank slide.

Pass each source PDF file to [`SlideCollection.add_from_pdf`](https://reference.aspose.com/slides/python-net/aspose.slides/slidecollection/add_from_pdf/) in the required order.

Call `Presentation.save` with `SaveFormat.HTML5` to export the combined presentation as a single HTML file.

## Export PDF to Other Supported Formats
