การติดตั้ง

Aspose.Slides for Node.js via .NET เป็น API ที่ไม่ขึ้นกับแพลตฟอร์มและสามารถใช้ได้บนทุกแพลตฟอร์ม (Windows, Linux และ MacOS) ที่ติดตั้ง Node.js และ bridge edge-js ไปแล้ว.

ติดตั้งจาก NPM

คุณสามารถติดตั้ง Aspose.Slides for Node.js via .NET จาก NPM ผ่านคำสั่งต่อไปนี้:

$ npm install aspose.slides.via.net

หากคุณพบปัญหาใด ๆ ระหว่างกระบวนการติดตั้ง โปรดดูที่ https://www.npmjs.com/package/edge-js.

ติดตั้งจากไฟล์ ZIP

เพื่อทำการติดตั้งและใช้ Aspose.Slides for Node.js via .NET จากไฟล์ ZIP ให้ทำตามคำแนะนำต่อไปนี้แทน:

Windows

  1. ติดตั้ง .NET6 หรือรุ่นที่สูงกว่า.
  2. ติดตั้ง Node.js (https://nodejs.org/en/download/) และเพิ่ม node.exe ไปยัง PATH.
  3. ติดตั้ง edge-js.
$ mkdir aspose.slides.nodejs.net

$ cd aspose.slides.nodejs.net

$ npm install -g edge-js
  1. ดาวน์โหลด Aspose.Slides for Node.js via .NET และแตกไฟล์ไปยัง aspose.slides.nodejs/node_modules/aspose.slides.via.net.
  2. สร้างไฟล์ชื่อ hello.js ในโฟลเดอร์ aspose.slides.nodejs.net โดยใช้โค้ดตัวอย่างต่อไปนี้:
// นำเข้าโมดูล Aspose.Slides สำหรับการจัดการไฟล์ PowerPoint
const asposeSlides = require('aspose.slides.via.net');

// เพิ่มคลาสที่จำเป็นจาก asposeSlides
const { Presentation, SaveFormat, PdfOptions } = asposeSlides;

const fs = require('fs');
if (!fs.existsSync("out")) fs.mkdirSync("out");

// สร้างและบันทึกการนำเสนอเปล่าเพื่อสาธิตการทำงานพื้นฐาน
function createEmptyPresentation() {
	
    // กำหนดค่าเริ่มต้นการนำเสนอเปล่าใหม่
    var emptyPresentation = new Presentation();
    
    // บันทึกการนำเสนอเปล่าเป็นรูปแบบ PPTX
    emptyPresentation.save("out/emptyPresentation.pptx", SaveFormat.Pptx);
    
    // ปล่อยทรัพยากรที่เกี่ยวข้องกับการนำเสนอ
    emptyPresentation.dispose();
}

createEmptyPresentation(); // เรียกใช้ฟังก์ชันเพื่อสร้างการนำเสนอเปล่า
  1. ตอนนี้รัน node hello.js ที่ command prompt เพื่อเรียกใช้งาน.

Linux

  1. ติดตั้ง .NET6 หรือรุ่นที่สูงกว่า.
  2. ติดตั้ง Node.js (https://nodejs.org/en/download/) และเพิ่ม node.exe ไปยัง PATH.
  3. ติดตั้ง edge-js.
$ mkdir aspose.slides.nodejs.net

$ cd aspose.slides.nodejs.net

$ npm install edge-js
  1. ดาวน์โหลด Aspose.Slides for Node.js via Java และแตกไฟล์ไปยัง aspose.slides.nodejs/node_modules/aspose.slides.via.net.
  2. สร้างไฟล์ทดสอบชื่อ hello.js โดยใช้โค้ดตัวอย่างนี้ในโฟลเดอร์ aspose.slides.nodejs.net:
// นำเข้าโมดูล Aspose.Slides สำหรับการจัดการไฟล์ PowerPoint
const asposeSlides = require('aspose.slides.via.net');

// เพิ่มคลาสที่จำเป็นจาก asposeSlides
const { Presentation, SaveFormat, PdfOptions } = asposeSlides;

const fs = require('fs');
if (!fs.existsSync("out")) fs.mkdirSync("out");

// สร้างและบันทึกการนำเสนอเปล่าเพื่อสาธิตการทำงานพื้นฐาน
function createEmptyPresentation() {
	
    // กำหนดค่าเริ่มต้นการนำเสนอเปล่าใหม่
    var emptyPresentation = new Presentation();
    
    // บันทึกการนำเสนอเปล่าในรูปแบบ PPTX
    emptyPresentation.save("out/emptyPresentation.pptx", SaveFormat.Pptx);
    
    // ปล่อยทรัพยากรที่เกี่ยวข้องกับการนำเสนอ
    emptyPresentation.dispose();
}

createEmptyPresentation(); // เรียกใช้ฟังก์ชันเพื่อสร้างการนำเสนอเปล่า
  1. ตอนนี้รัน node hello.js ที่ command prompt เพื่อเรียกใช้งาน.

Mac

  1. ติดตั้ง .NET6 หรือรุ่นที่สูงกว่า.
  2. ติดตั้ง Node.js (https://nodejs.org/en/download/) และเพิ่ม node.exe ไปยัง PATH.
  3. ติดตั้ง edge-js.

$ mkdir aspose.slides.nodejs.net

$ cd aspose.slides.nodejs.net

$ npm install edge-js


```javascript
// Import the Aspose.Slides module for PowerPoint file manipulation
const asposeSlides = require('aspose.slides.via.net');

// Add necessary classes from the asposeSlides
const { Presentation, SaveFormat, PdfOptions } = asposeSlides;

const fs = require('fs');
if (!fs.existsSync("out")) fs.mkdirSync("out");

// Create and save an empty presentation to demonstrate basic functionality
function createEmptyPresentation() {
	
    // Initialize a new empty presentation
    var emptyPresentation = new Presentation();
    
    // Save the empty presentation in PPTX format
    emptyPresentation.save("out/emptyPresentation.pptx", SaveFormat.Pptx);
    
    // Release resources associated with the presentation
    emptyPresentation.dispose();
}

createEmptyPresentation(); // Execute the function to create an empty presentation
9. ตอนนี้รัน `node hello.js` ที่ command prompt เพื่อเรียกใช้งาน.