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

How to add "nNonPrint" Javascript to PDF

Community Beginner ,
Jul 25, 2020 Jul 25, 2020

Copy link to clipboard

Copied

I'm trying to flatten a pdf but retain the weblinks. When I searched online, this came up - 

 

this.flattenPages({nNonPrint: 1});

 

I don't know Javascript and can't figure out how to add this to the PDF. I could really use some help here!  

TOPICS
Edit and convert PDFs , PDF forms

Views

1.3K

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
LEGEND ,
Jul 25, 2020 Jul 25, 2020

Copy link to clipboard

Copied

This script cannot work in Reader. You can use it in paid-for Acrobat with the JavaScript console. 

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

I have the paid version - Acrobat DC Pro. Do you mean the people who print it have to have the paid version as well?

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

You can attach it to the Mouse Up event of a button and then click that button, or you could run it from the JS Console.

See: https://acrobatusers.com/tutorials/javascript_console

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

Does that work even after the PDF has been flattened (printed as PDF) ?

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

No, that's how you flatten it in the first place.

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
LEGEND ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

I don't see the connection to printing. Perhaps you can explain the problem you want to solve. Certainly anyone who runs that script needs the paid-for Acrobat. 

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

I have the paid version.

The reason I'm printing as PDF is to essentially flatten the PDF.

I have a fill form pdf which I will send to employees, who will fill them
up and flatten (print) the PDF so that it's no longer editable.

The PDF also has weblinks that that won't work once the PDF is flattened. I
need the JavaScript for flattening the PDF but also retain the weblinks
functionality.

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

You can set the form fields as read only.

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

I have to flatten it after the form is filled. Which means I'd have to have my employees fill in the form and then edit the PDF to read-only which isn't practical for my situation.

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

It can be done with literally a single click of a button.

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

So you don't need a paid-version or need to edit PDF to change form to READ-ONLY?

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

Nope. The free Adobe Reader can do it.

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

How do I do that? I can't seem to find the option for converting form field to READ-ONLY.

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

It requires using a script.

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

It's alright. I've been messing with adding the code much to my dismay. If I really need to work it out, I'm hoping this will work - https://turbofuture.com/computers/How-to-Change-A-PDF-Form-to-Read-Only-Before-the-User-Submits

I'm guessing this is what you meant as well. Thankyou for the response

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

LATEST

This is all you need:

 

for (var i=0; i<this.numFields; i++) {
	var f = this.getField(this.getNthFieldName(i));
	if (f==null) continue;
	f.readonly = true;
}

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 ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

Correct.

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 Beginner ,
Jul 26, 2020 Jul 26, 2020

Copy link to clipboard

Copied

Again the flow goes like

 

I create a form --> Employee fills form --> Employee flattens PDF --> Employee sends to clients

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