How to remove all the textboxes in my pdf?

Explorer ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

I want to remove all the text boxes in my PDF but after searching a while, I didn't find any solution. I assume a script is necessary here. I know Python programming, so I assume javascript is just a syntax issue. Could someone provide some ideas about how the script should look like? Thanks!

 

In the document it looks like this on the bottom of every page 

7-8-2020 6.37.06 PM 0005.png

TOPICS
Acrobat SDK and JavaScript, Edit and convert PDFs, How to

Views

177

Likes

translate

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
Adobe Community Professional ,
Jul 07, 2020 Jul 07, 2020

Copy link to clipboard

Copied

Want you remove all form text fields?

Likes

translate

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
Explorer ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

They are inserted text boxes, the same as one when you want to insert a text on to a page. 

Likes

translate

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
Most Valuable Participant ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

There are at least three different ways of doing that, please be more specific about what exact tool you're using to add those "text boxes".

Likes

translate

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
Explorer ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

Sorry for the confusion, the "Add text" tool

Likes

translate

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
Most Valuable Participant ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

"Add Text" commenting tool?

Likes

translate

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
Most Valuable Participant ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

You can use this code to do it:

 

for (var i=this.numFields-1; i>=0; i--) {
	var f = this.getField(this.getNthFieldName(i));
	if (f==null) continue;
	if (f.type=="text") this.removeField(f.name);
}

Likes

translate

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
Explorer ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

I got 

SyntaxError: syntax error
1:Console:Exec
undefined

I checked a bit and this.numFields is 0. I think you probably understand the text boxes wrong. The ones I am having in my pdf are the same as the ones when you use the "Add text" tool.

Likes

translate

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
Adobe Community Professional ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

Does you use comments?

Can you post a screenshot?

Likes

translate

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
Explorer ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

7-8-2020 6.34.15 PM 0004.png

The screent shot on the content panel. It would be nice if the Container and the Annotations can also be removed. 

Likes

translate

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
Adobe Community Professional ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

Annotations can be removed with a script. See above.

Likes

translate

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
Adobe Community Professional ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

Page Content cannot be modified with a script. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

translate

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
Most Valuable Participant ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

Not quite true. It can be removed, using redactions. And it can be added, by flattening fields or comments.

Likes

translate

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
Adobe Community Professional ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

Yes, that right. But it's definately the long way around. And no reflow. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

translate

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
Adobe Community Professional ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

It is better to change the original document and re-create the PDF file.

Likes

translate

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
Adobe Community Professional ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

You can use preflight profiles to move all of the page content text to a new layer, and delete that layer, although this would affect all (live) text and would probably ignore outlined text.

Remove Text.png

 

 

Likes

translate

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
Most Valuable Participant ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

The fact there are no fields in the file should not cause an error. It will just mean that nothing happens when you run the script.

Likes

translate

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
Adobe Community Professional ,
Jul 08, 2020 Jul 08, 2020

Copy link to clipboard

Copied

Ha ha. Explicit language is very important for solving technical issue. We have to know what you are talking about. Gilad thought you mean text fields, but you mean something else. Very important distinction.  

 

If you are using the commenting tools to add test, then use this code in the console window

 

this.getAnnots().forEach(function(a){if(a.type == "FreeText") a.destroy()});

 

But if you are using the "Edit PDF" tools, your SOL.  That text is part of the page contents. JavaScript only has access to annotations. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

translate

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