AsposePdfGetAttachment

Get attachment from a PDF-file.

function AsposePdfGetAttachment(
    fileName,
    fileNameResult
)

Parameters:

  • fileName file name
  • fileNameResult result file name template (for sample: “ResultPdfGetAttachment_{0}” where {0} - name of attachment)

Return: JSON object

  • errorCode - code error (0 no error)
  • errorText - text error ("" no error)
  • filesCount - attachment files count
  • filesNameResult - array of result filenames

CommonJS:

const AsposePdf = require('asposepdfnodejs');
const pdf_file = 'Aspose.pdf';
AsposePdf().then(AsposePdfModule => {
    /*Get attachment from a PDF-file and save with template "ResultPdfGetAttachment_{0}" ({0} - name of attachment)*/
    const json = AsposePdfModule.AsposePdfGetAttachment(pdf_file, "ResultPdfGetAttachment_{0}");
    console.log("AsposePdfGetAttachment => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);
});

ECMAScript/ES6:

import AsposePdf from 'asposepdfnodejs';
const AsposePdfModule = await AsposePdf();
const pdf_file = 'Aspose.pdf';
/*Get attachment from a PDF-file and save with template "ResultPdfGetAttachment_{0}" ({0} - name of attachment)*/
const json = AsposePdfModule.AsposePdfGetAttachment(pdf_file, "ResultPdfGetAttachment_{0}");
console.log("AsposePdfGetAttachment => %O", json.errorCode == 0 ? json.filesNameResult : json.errorText);