PDF veya HTML'den JavaScript ile Sunumları İçe Aktarma

Giriş

Using Aspose.Slides for Node.js via Java, you can import presentations from files in other formats. Aspose.Slides provides the SlideCollection class to allow you to import presentations from PDFs, HTML documents, etc.

PDF’ten PowerPoint’e Aktarım

Bu durumda, bir PDF’yi PowerPoint sunumuna dönüştürebilirsiniz.

pdf-to-powerpoint

  1. Bir Presentation sınıfının örneğini oluşturun.
  2. PDF dosyasını geçerek addFromPdf() metodunu çağırın.
  3. Dosyayı PowerPoint formatında kaydetmek için save() metodunu kullanın.

Bu JavaScript kodu PDF’ten PowerPoint’e dönüşüm işlemini gösterir:

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();
    }
}

HTML’den PowerPoint’e Aktarım

Bu durumda, bir HTML belgesini PowerPoint sunumuna dönüştürebilirsiniz.

  1. Bir Presentation sınıfının örneğini oluşturun.
  2. HTML dosyasını geçerek addFromHtml() metodunu çağırın.
  3. Dosyayı PowerPoint formatında kaydetmek için save() metodunu kullanın.

Bu JavaScript kodu HTML’den PowerPoint’e dönüşüm işlemini gösterir:

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();
    }
}

SSS

PDF içe aktarılırken tablolar korunur mu ve algılamaları iyileştirilebilir mi?

Tablolar içe aktarma sırasında algılanabilir; PdfImportOptions içinde tablo tanımasını etkinleştiren bir setDetectTables metodu bulunur. Etkinlik, PDF’nin yapısına bağlıdır.