Extract Text from PowerPoint Presentation using Node.js API - PowerPoint Text Extractor

ถ้าคุณต้องการดึงข้อมูลจากการนำเสนอ Microsoft PowerPoint สำหรับการทำงานอัตโนมัติ, การเก็บถาวร, หรือการจัดทำดัชนีการค้นหา, GroupDocs.Parser Cloud SDK สำหรับ Node.js เสนอวิธีแก้ปัญหาที่อยู่บนคลาวด์ซึ่งรวดเร็ว, ยืดหยุ่น, และง่ายต่อการรวมเข้ากับระบบ. ด้วยโค้ดเพียงไม่กี่บรรทัด, คุณสามารถดึงข้อความธรรมดาหรือข้อความที่มีโครงสร้างจาก .ppt และ .pptx ไฟล์โดยไม่ต้องพึ่งพา Microsoft Office.

API การดึงข้อความจาก PowerPoint

SDK GroupDocs.Parser Cloud SDK for Node.js เป็น SDK ระดับสูงที่สร้างขึ้นบน REST API ที่มีประสิทธิภาพซึ่งช่วยให้คุณสามารถสกัดข้อมูล:

  • ข้อความสไลด์ (ต่อสไลด์หรือทั้งการนำเสนอ)
  • Structured content from tables.
  • Metadata.
  • ไฟล์หรือรูปภาพที่ฝังอยู่.

มันรองรับรูปแบบที่หลากหลาย รวมถึง PDF, Word, Excel, PowerPoint, MSG, ZIP, และอื่น ๆ เพิ่มเติม

ข้อกำหนดเบื้องต้น

  1. ลงทะเบียนที่ GroupDocs.Cloud Dashboard.
  2. รับ Client ID และ Client Secret ของคุณ
  3. ติดตั้ง SDK:
npm install groupdocs-parser-cloud

เยี่ยมชมลิงก์ต่อไปนี้เพื่อเรียนรู้เพิ่มเติมเกี่ยวกับ, how to obtain your Client ID and Client Secret for authentication.

วิธีการดึงข้อความจาก PowerPoint ด้วย Node.js

ส่วนนี้ให้รายละเอียดเกี่ยวกับวิธีที่เราสามารถดึงข้อความจากงานนำเสนอ PowerPoint โดยใช้ SDK ของ Node.js ได้อย่างเป็นโปรแกรม

ขั้นตอนที่ 1: ตั้งค่าเริ่มต้น:

const { ParserApi, Configuration, ImagesRequest, FileInfo, ImagesOptions } = require("groupdocs-parser-cloud");

const config = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
const parserApi = new ParserApi(config);

ขั้นตอนที่ 2: ตั้งค่าไฟล์ข้อมูลและตัวเลือก: สร้างอ็อบเจกต์ของคลาส TextRequest และส่งผ่านอ็อบเจกต์ของคลาส TextOptions.

const fileInfo = new FileInfo();
// path to PowerPoint presentation
fileInfo.filePath = "input.pptx";

const options = new TextOptions();
options.fileInfo = fileInfo;

const request = new TextRequest(options);

ขั้นตอนที่ 3: ดึงข้อความจาก PowerPoint: เรียกใช้วิธีการ text และมันจะส่งคืนข้อความธรรมดาจากการนำเสนอ PowerPoint

parserApi.text(request).then(response => {
    console.log("Extracted text content:");
    console.log(response.text);
}).catch(err => {
    console.error("Error extracting text:", err);
});
// สำหรับตัวอย่างเพิ่มเติม โปรดเยี่ยมชม https://github.com/groupdocs-parser-cloud/groupdocs-parser-cloud-node
const { Configuration, ParserApi, TextOptions, TextRequest, FileInfo } = require("groupdocs-parser-cloud");

const config = new Configuration("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");
const parserApi = new ParserApi(config);

const fileInfo = new FileInfo();
// Input PowerPoint path
fileInfo.filePath = "input.pptx";

// ระบุวัตถุ TextOptions
const options = new TextOptions();
options.fileInfo = fileInfo;

const request = new TextRequest(options);

parserApi.text(request).then(response => {
    console.log("Extracted text content:");
    console.log(response.text);
}).catch(err => {
    console.error("Error extracting text:", err);
});

คุณสามารถดูผลลัพธ์ของตัวอย่างโค้ดข้างต้นในภาพด้านล่าง:

extract powerpoint PowerPoint presentation text

Extract Text from PowerPoint via cURL

หากคุณชอบการทำงานผ่านคำสั่งในบรรทัดหรือต้องการรวมเข้ากับสคริปต์? คุณสามารถดึงข้อความจากเอกสาร Word โดยใช้ cURL และ GroupDocs.Parser REST API.

ขั้นตอนที่ 1 – สร้าง Access Token:

curl -X POST "https://api.groupdocs.cloud/connect/token" \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded"

ขั้นตอนที่ 2 – ดึงข้อความผ่านการเรียก API:

curl -v -X POST "https://api.groupdocs.cloud/v1.0/parser/text" \
-H  "accept: application/json" \
-H  "authorization: Bearer {ACCESS_TOKEN}" \
-H  "Content-Type: application/json" \
-d 
    "{  
        \"FileInfo\": 
        {
            \"FilePath\": \"input.pptx\",
            \"StorageName\": \"internal\"
        }
    }"
  • แทนที่ ด้วยโทเค็นที่คุณสร้างขึ้น

การใช้ cURL กับ GroupDocs.Parser API มีประโยชน์ดังนี้

  • ✅ ไม่มีการติดตั้ง SDK.
  • ✅ เหมาะสำหรับสคริปต์ bash หรือ cron jobs.
  • ✅ ทำงานในสภาพแวดล้อมของ Linux, macOS และ Windows
  • ✅ น้ำหนักเบาและรวดเร็ว。

Free PowerPoint Text Extractor

ใช้ Free Online PowerPoint Text Extractor ของเรา ซึ่งขับเคลื่อนโดย GroupDocs.Parser Cloud หากคุณต้องการตัวเลือกที่ไม่ต้องเขียนโค้ด

เครื่องมือเบิกข้อความจาก PowerPoint ออนไลน์

ข้อสรุป

Using GroupDocs.Parser Cloud SDK for Node.js, you can extract text from PowerPoint presentations efficiently with minimal code. The SDK and REST API support modern development workflows — whether you prefer programmatic SDKs or lightweight cURL scripts.

📚 แหล่งข้อมูลเพิ่มเติม

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

  1. Can I extract text from slides with formatting?
  • ใช่. API จะส่งคืนข้อความที่มีโครงสร้างรวมถึงลำดับของสไลด์.
  1. Is PowerPoint required to extract content?
  • ไม่. API ทำงานในคลาวด์และไม่ขึ้นอยู่กับ Microsoft Office.
  1. ราคาคืออะไร?
  • เรามีโมเดลการกำหนดราคาแบบจ่ายครั้งเดียวตามการใช้งาน สำหรับข้อมูลเพิ่มเติม โปรดเยี่ยมชม pricing guide.
  1. มีการทดลองใช้ฟรีหรือไม่?
  • ใช่ คุณสามารถทำการเรียก API ได้สูงสุด 150 ครั้งต่อเดือนด้วยบัญชีทดลองฟรี สำหรับรายละเอียดเพิ่มเติม โปรดไปที่ pricing guide.

บทความที่แนะนำ