Add Header to PDF via JavaScript via C++

Add Header to PDF File using JavaScript via C++.

Add Headers to PDF Document Using JavaScript via C++

Headers and footers often contain information that identifies the document, such as the document title, author name, company logo, or copyright information. In order to add Header or Footer in PDF file, we’ll use Aspose.PDF for JavaScript via C++ is a easy and secure toolkit used to work with PDF directly in the web browser. To install and use Aspose.PDF for JavaScript via C++ extract files from the ZIP archive.

Add Header to PDF with JavaScript via C++


You need Aspose.PDF for JavaScript via C++ to try the code in your environment.

  1. Open a PDF document using Document object.
  2. Create a Stamp and define its properties.
  3. Add the Stamp to Page using AddStamp method.
  4. Save the PDF file.

Add a Header to PDF Document - JavaScript via C++

This sample code shows how to add Header to PDF


    var ffileAddTextHeaderFooter = function (e) {
        const file_reader = new FileReader();
        file_reader.onload = (event) => {
        /*add page header a PDF-file and save the "ResultAddHeader.pdf"*/
        const json = AsposePdfAddTextHeaderFooter(event.target.result, e.target.files[0].name, "Aspose.PDF for JavaScript via C++", "", "ResultAddHeader.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]);
    };