• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using JavaScript to remove generated page footer text

New Here ,
Sep 27, 2024 Sep 27, 2024

Copy link to clipboard

Copied

I've written a basic script that does some adjustments to a PDF generated via HTML, such as renaming and formatting fields, setting the doc title, etc., and am looking to extend it to remove the generated footer text on each page, but cannot figure out how to achieve this.

 

Every page's footer is generated similar to 'file:///C/PDFs/Html%20Templates/new_form.html[9/27/2024 10:38:40 AM]'. I can edit and remove this manually, but I'd like for the script to achieve the same. Is it possible to access and remove these text fields through the script, or am I out of luck?

 

function trimFields(formTitle = "", verbose = false) {
    console.println("Starting trimFields...");
    
    if (formTitle) {
        this.title = formTitle;
        console.println("Form title set to " + this.title);
    }

    // Copy originals so as to not iterate the array while changing it
    var originalFields = [];
    for (var i = 0; i < this.numFields; i++) {
        originalFields.push(this.getNthFieldName(i));
    }
    
    // .. omitted for brevity
}

 

TOPICS
How to , JavaScript , PDF

Views

188

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 27, 2024 Sep 27, 2024

Copy link to clipboard

Copied

You can avoid the text when you change the conversion settings.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2024 Sep 27, 2024

Copy link to clipboard

Copied

I hadn't realized there was a different between supplying an HTML file for the "Single File" and doing it through "Web Page", very appreciated.

 

However, assuming whoever generated the PDF still has the leftover footer text, is it possible to extend to script to handle removal?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 28, 2024 Sep 28, 2024

Copy link to clipboard

Copied

LATEST

You can add Redaction annotations (using addAnnot) over these texts and then apply them (using applyRedactions), to remove them from the file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines