PHP에서 PDF 또는 HTML로 프레젠테이션 가져오기
Contents
[
Hide
]
소개
Aspose.Slides for PHP via Java를 사용하면 다른 형식의 파일에서 프레젠테이션을 가져올 수 있습니다. Aspose.Slides는 PDF, HTML 문서 등에서 프레젠테이션을 가져올 수 있도록 SlideCollection 클래스를 제공합니다.
PDF에서 PowerPoint로 가져오기
이 경우 PDF를 PowerPoint 프레젠테이션으로 변환합니다.

- Presentation 클래스의 인스턴스를 생성합니다.
- addFromPdf() 메서드를 호출하고 PDF 파일을 전달합니다.
- save() 메서드를 사용하여 파일을 PowerPoint 형식으로 저장합니다.
이 PHP 코드는 PDF를 PowerPoint로 변환하는 작업을 보여줍니다:
$pres = new Presentation();
try {
$pres->getSlides()->addFromPdf("InputPDF.pdf");
$pres->save("OutputPresentation.pptx", SaveFormat::Pptx);
} finally {
if (!java_is_null($pres)) {
$pres->dispose();
}
}
Tip
여기서 설명한 프로세스의 실시간 구현이므로 Aspose free PDF to PowerPoint 웹 앱을 확인해 보세요.HTML에서 PowerPoint로 가져오기
이 경우 HTML 문서를 PowerPoint 프레젠테이션으로 변환합니다.
- Presentation 클래스의 인스턴스를 생성합니다.
- addFromHtml() 메서드를 호출하고 PDF 파일을 전달합니다.
- save() 메서드를 사용하여 파일을 PowerPoint 형식으로 저장합니다.
이 PHP 코드는 HTML을 PowerPoint로 변환하는 작업을 보여줍니다:
$presentation = new Presentation();
try {
$htmlStream = new Java("java.io.FileInputStream", "page.html");
try {
$presentation->getSlides()->addFromHtml($htmlStream);
} finally {
if (!java_is_null($htmlStream)) {
$htmlStream->close();
}
}
$presentation->save("MyPresentation.pptx", SaveFormat::Pptx);
} catch (JavaException $e) {
} finally {
if (!java_is_null($presentation)) {
$presentation->dispose();
}
}
FAQ
PDF를 가져올 때 표가 보존되며, 표 탐지를 개선할 수 있나요?
가져오는 동안 표를 감지할 수 있습니다; PdfImportOptions에는 표 인식을 활성화하는 setDetectTables 메서드가 포함되어 있습니다. 효과는 PDF 구조에 따라 달라집니다.
Note
Aspose.Slides를 사용하여 HTML을 다른 일반 파일 형식으로 변환할 수도 있습니다: