Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Does you mean form text fields?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
Looks like a space character. Acrobat Javascript can't remove this.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
This is only possible if the text is located inside of comments or fields, not if it's static text.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now