Highlighted

How to add "nNonPrint" Javascript to PDF

Community Beginner ,
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

58

Likes

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

How to add "nNonPrint" Javascript to PDF

Community Beginner ,
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

59

Likes

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
Jul 25, 2020 0
Most Valuable Participant ,
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. 

Likes

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
Reply
Loading...
Jul 25, 2020 0
Community Beginner ,
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?

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
Jul 26, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
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. 

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Adobe Community Professional ,
Jul 26, 2020

Copy link to clipboard

Copied

You can set the form fields as read only.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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?

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

Nope. The free Adobe Reader can do it.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Adobe Community Professional ,
Jul 26, 2020

Copy link to clipboard

Copied

Correct.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

It requires using a script.

Likes

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
Reply
Loading...
Jul 26, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
Jul 26, 2020 0
try67 LATEST
Most Valuable Participant ,
Jul 26, 2020

Copy link to clipboard

Copied

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;
}

Likes

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
Reply
Loading...
Jul 26, 2020 0