นำเข้าการนำเสนอจาก PDF หรือ HTML บน Android

บทนำ

Using Aspose.Slides สำหรับ Android ผ่าน 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.

นำเข้า PowerPoint จาก PDF

ในกรณีนี้ คุณจะทำการแปลงไฟล์ PDF เป็นงานนำเสนอ PowerPoint

pdf-to-powerpoint

  1. สร้างอินสแตนซ์ของคลาส Presentation .
  2. เรียกใช้เมธอด addFromPdf() และส่งไฟล์ PDF .
  3. ใช้เมธอด save() เพื่อบันทึกไฟล์ในรูปแบบ PowerPoint .

This Java code demonstrates the PDF to PowerPoint operation:

Presentation pres = new Presentation();
try {
    pres.getSlides().addFromPdf("InputPDF.pdf");
    pres.save("OutputPresentation.pptx", SaveFormat.Pptx);
} finally {
    if (pres != null) pres.dispose();
}

นำเข้า PowerPoint จาก HTML

ในกรณีนี้ คุณจะทำการแปลงเอกสาร HTML เป็นงานนำเสนอ PowerPoint.

  1. สร้างอินสแตนซ์ของคลาส Presentation .
  2. เรียกใช้เมธอด addFromHtml() และส่งไฟล์ HTML .
  3. ใช้เมธอด save() เพื่อบันทึกไฟล์ในรูปแบบ PowerPoint .

This Java code demonstrates the HTML to PowerPoint operation:

Presentation presentation = new Presentation();
try {
    FileInputStream htmlStream = new FileInputStream("page.html");
    try {
        presentation.getSlides().addFromHtml(htmlStream);
    } finally {
        if (htmlStream != null) htmlStream.close();
    }

    presentation.save("MyPresentation.pptx", SaveFormat.Pptx);
} catch(IOException e) {
} finally {
    if (presentation != null) presentation.dispose();
}

คำถามที่พบบ่อย

ตารางจะถูกคงไว้เมื่อทำการนำเข้า PDF หรือไม่ และการตรวจจับสามารถปรับปรุงได้หรือไม่?

ตารางสามารถตรวจจับได้ระหว่างการนำเข้า; PdfImportOptions มีเมธอด setDetectTables ที่เปิดใช้งานการรู้จำตาราง. ประสิทธิภาพขึ้นอยู่กับโครงสร้างของ PDF.