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

Remove text lines that are empty?

Participant ,
Jul 01, 2019 Jul 01, 2019

In our workflow for pre-press, we get a lot of documents that we need to optimize, and very often something that gets in the way are lines with empty text. Usually it's just a space or a hard return, no other characters are in the text field. It tends to throw off the whole page when we try to automatically scale it because the page is using that empty text box when it scales and the text is in a weird spot. If we could remove these sorts of text boxes, that would be amazing.

Seems like a simple script should do the trick. Any help appreciated.

TOPICS
Acrobat SDK and JavaScript
2.3K
Translate
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 02, 2019 Jul 02, 2019

Does you mean form text fields?

Translate
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
Participant ,
Jul 02, 2019 Jul 02, 2019

No, I mean regular text, like if you exported a word document to pdf. Wherever there's a return, there's a blank text item that I'm referring to.

Translate
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 02, 2019 Jul 02, 2019

You can try the Edit Text tool, but PDF files were not really meant to be edited in this way, so the results are not likely to be very good.

This is really something that needs to be done on the original file, and then a new PDF file needs to be created from it.

Translate
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
Participant ,
Jul 02, 2019 Jul 02, 2019

If we edit the original file, we're doing several extra steps when we could be doing just one. Also, some of these line breaks that are problematic for us, are actually necessary for the initial formatting of the document.

Maybe it's worth noting that something similar is possible using Pitstop Pro, a 3rd party plugin for Acrobat. It can do things like remove lines that contain a certain character, or phrase, however there is no option to remove a line that has only nothing in it, or just a line break. My thought was maybe javascript can do it.

Translate
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 02, 2019 Jul 02, 2019

There are no real line breaks in a PDF, or empty lines. Each piece of text is placed on the page independently.

Anyway, JavaScript can't do it.

Translate
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
Participant ,
Jul 02, 2019 Jul 02, 2019

There may be no real line breaks but the result of a line break or space or indent that's on its own line is something that is a problem in many cases.

Here's what that looks like to Pitstop

Screen Shot 2019-07-02 at 10.02.03 AM.png

This tells you it is in fact a text line. It has its own font and everything. But it's empty or "empty" if you can't truly have an empty line.

And here it is showing in Acrobat's content panel. This to me says that if Acrobat can see this is there, and can also see that there is no text, then a script could remove this.  Screen Shot 2019-07-02 at 10.10.21 AM.png

Translate
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 02, 2019 Jul 02, 2019

Looks like a space character. Acrobat Javascript can't remove this.

Translate
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 02, 2019 Jul 02, 2019

And here it is showing in Acrobat's content panel. This to me says that if Acrobat can see this is there, and can also see that there is no text, then a script could remove this.

It might be a space character, or even a line-break character (some applications insert them into PDF files, even though they don't mean anything in that context). Your assumption is incorrect, though. JavaScript can't edit the static text of a PDF file, unless it does so through the redaction tool. In theory it might be possible to identify this character with a script, place a Redaction annotation on top of it and then apply that redaction to remove it (as well as anything under it), but that is quite a complex task that will require the development of a custom-made script.

Translate
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
Participant ,
Jul 02, 2019 Jul 02, 2019
LATEST

Thank you. I guess I thought that with scripts, if the interface supports it, then it should be scriptable. The "empty" text lines appear in the content tab of acrobat, and you can right click these and delete them.

Translate
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 02, 2019 Jul 02, 2019

This is only possible if the text is located inside of comments or fields, not if it's static text.

Translate
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