通過JavaScript via C++從PDF文檔中刪除圖像

JavaScript via C++ 庫,用於使用自己的 API 從 PDF 中刪除圖像。

使用 JavaScript via C++ 庫從 PDF 文件中刪除圖像

為了在PDF檔中添加圖像,我們將使用[Aspose.PDF](https://products.aspose.com/pdf)API,這是一個功能豐富,功能強大且易於使用的文檔操作API,適用於 javascript-cpp 平臺。打開 [NuGet](https://www.nuget.org/packages/aspose.pdf) 包管理器,搜索“.PDF”並安裝。您也可以從程式包管理器主控台使用以下命令。

通過JavaScript via C++從 PDF 中刪除圖像


您需要 [Aspose.PDF 庫](https://releases.aspose.com/pdf) 來嘗試環境中的代碼。

  1. 開啟現有的 PDF 文件。
  2. 刪除特定影像。
  3. 儲存更新的 PDF 檔。

從現有 PDF 檔案中移除影像 - JavaScript via C++。

<% images-remove.code-block.subtitle %>


 var ffilePdfDeleteImages = function (e) {
    const file_reader = new FileReader();
    file_reader.onload = (event) => {
    /*Delete images from a PDF-file and save the "ResultPdfDeleteImages.pdf"*/
    const json = AsposePdfDeleteImages(event.target.result, e.target.files[0].name, "ResultPdfDeleteImages.pdf");
    if (json.errorCode == 0) document.getElementById('output').textContent = json.fileNameResult;
    else document.getElementById('output').textContent = json.errorText;
    /*Make a link to download the result file*/
    DownloadFile(json.fileNameResult, "application/pdf");
    };
    file_reader.readAsArrayBuffer(e.target.files[0]);
};