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

- Presentation 클래스의 인스턴스를 생성합니다.
- addFromPdf() 메서드를 호출하고 PDF 파일을 전달합니다.
- save() 메서드를 사용해 파일을 PowerPoint 형식으로 저장합니다.
다음 JavaScript 코드는 PDF를 PowerPoint로 변환하는 예시입니다:
var pres = new aspose.slides.Presentation();
try {
pres.getSlides().addFromPdf("InputPDF.pdf");
pres.save("OutputPresentation.pptx", aspose.slides.SaveFormat.Pptx);
} finally {
if (pres != null) {
pres.dispose();
}
}
Tip
여기서 설명한 프로세스의 실시간 구현인 Aspose 무료 PDF to PowerPoint 웹 앱을 확인해 보세요.HTML에서 PowerPoint 가져오기
이 경우 HTML 문서를 PowerPoint 프레젠테이션으로 변환합니다.
- Presentation 클래스의 인스턴스를 생성합니다.
- addFromHtml() 메서드를 호출하고 HTML 파일을 전달합니다.
- save() 메서드를 사용해 파일을 PowerPoint 형식으로 저장합니다.
다음 JavaScript 코드는 HTML을 PowerPoint로 변환하는 예시입니다:
var presentation = new aspose.slides.Presentation();
try {
var htmlStream = java.newInstanceSync("java.io.FileInputStream", "page.html");
try {
presentation.getSlides().addFromHtml(htmlStream);
} finally {
if (htmlStream != null) {
htmlStream.close();
}
}
presentation.save("MyPresentation.pptx", aspose.slides.SaveFormat.Pptx);
} catch (e) {
console.log(e);
} finally {
if (presentation != null) {
presentation.dispose();
}
}
FAQ
PDF를 가져올 때 표가 유지되고, 표 인식을 개선할 수 있나요?
표는 가져오기 과정에서 감지될 수 있습니다. PdfImportOptions에는 표 인식을 활성화하는 setDetectTables 메서드가 포함되어 있습니다. 효과는 PDF의 구조에 따라 달라집니다.