• 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 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

Views

2.0K

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

Copy link to clipboard

Copied

Want you remove all form text fields?

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
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. 

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 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".

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

Copy link to clipboard

Copied

Sorry for the confusion, the "Add text" tool

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

Copy link to clipboard

Copied

"Add Text" commenting tool?

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

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
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.

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

Copy link to clipboard

Copied

Does you use comments?

Can you post a screenshot?

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
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. 

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

Copy link to clipboard

Copied

Annotations can be removed with a script. See above.

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

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 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.

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

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

Copy link to clipboard

Copied

It is better to change the original document and re-create the PDF 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
Community Expert ,
Jul 09, 2020 Jul 09, 2020

Copy link to clipboard

Copied

LATEST

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

 

 

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 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.

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

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