PDF を JavaScript で要約

PDF を JavaScript で要約します。

OpenAI、Claude、Gemini などの主要な言語モデルとのシームレスな統合により、Node.js アプリケーション向けに、AI ベースの PDF 処理機能を幅広く提供します。

コード スニペットを表示

PDF ドキュメントを JavaScript で要約

JavaScript の大規模言語モデル(LLM)を使用して、PDF ファイルからキー情報をプログラムで抽出します。Aspose.Words for Node.js via .NET は、あなたの PDF ドキュメントを読み取り、元のテキストの本質的な意味を捉えた簡潔な要約を生成します。

PDF ファイルを JavaScript で要約する方法

  • PDF ファイルを Document オブジェクトにロードします
  • AI モデルを選択します — OpenAI (GPT-4o)、Google (Gemini)、または Claude
  • オプションの長さ設定で Summarize メソッドを呼び出します
  • 生成された要約を DOCX、PDF、またはサポートされている任意の形式で保存します

次の例は、PDF ドキュメントを JavaScript で要約する方法を示します。

JavaScript で PDF を要約するサンプルコード
リストからターゲットフォーマットを選択します
コードを実行する
npm install @aspose/words
コピー
const aw = require('@aspose/words');

const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;

// OpenAI または Google の生成言語モデルを使用します。
const model = aw.AI.AiModel.createGpt4OMini();
model.setApiKey(apiKey);

const options = new aw.AI.SummarizeOptions();
options.summaryLength = aw.AI.SummaryLength.Short;

const summary = model.summarize(doc, options);
summary.save("Output.pdf");
const aw = require('@aspose/words');

const doc = new aw.Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
const model = new CustomAiModel("my-model-24b", "https://your-server.com/v1");
model.setApiKey("");

const options = new aw.AI.SummarizeOptions();
options.summaryLength = aw.AI.SummaryLength.Short;

const summary = model.summarize(doc, options);
summary.save("Output.pdf");

class CustomAiModel extends aw.AI.OpenAiModel {
    constructor(name, url) {
        super(name);
        this._url = url;
    }
    get url() {
        return this._url;
    }
}
コードを実行する

PDF を JavaScript で要約する方法

  1. Aspose.Words for Node.js via .NET をインストールします。
  2. JavaScript プロジェクトにライブラリ参照(インポート)を追加します。
  3. JavaScript でソースファイルを開きます。
  4. メソッドを呼び出し、文書と SummarizeOptions パラメータを渡します。
  5. 処理が完了すると、必要な形式で新しいファイルとして保存できる簡潔な文書要約が取得できます。

Node.js via .NET ライブラリで PDF ファイルを要約

We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.

System Requirements

This package is compatible with Node.js 14.17.0 or higher.

5%

Aspose製品アップデートを購読する

メールボックスに直接配信される月刊ニュースレターとオファーを入手してください。

© Aspose Pty Ltd 2001-2026. 全著作権所有。