How to replace text at predetermined positions?

Hello,

Thank you for quick reply. You are right for your approach, but I want to change the text only at specified positions, not in the complete document.

A complete searching and replacing of text I can do with several tools (also freeware), but I found only this tool for searching/replacing text exclusively at predetermined positions. The attached file was an example to demonstrate the problem. In this example the searched text exists only once on a page so the result is correct but this is not necessarily the normal situation.

Best Regards
Customer
--------------------------------

image

"VeryPDF PDF Text Replacer Command Line (pdftr.exe)" home page,

https://www.verypdf.com/app/pdf-text-replacer/try-and-buy.html#buy-cmd
https://www.verypdf.com/dl2.php/pdftextreplacer_cmd.zip

Thanks for your message, you can use PDF Text Replacer Command Line software pdftr.exe to replace text in all pages easily, it's a complete searching and replacing of text contents, however, pdftr.exe hasn't an option to replace text on special position yet, but if this function is important to you, we could implement "overlay text by position" and "overlay color rectangle by position" two functions to you, these new functions will work like below,

1. You can run following command line to show all text strings and their positions by following command line,

pdftr.exe -listtext D:\downloads\Test3.pdf

"-listtext" is an option to list all text lines and their positions in all PDF pages or selected pages.

You will get following information form your sample PDF file,

E:\pdftextreplacer_cmd\pdftr.exe -listtext D:\downloads\Test3.pdf
===== Search keyword in page 1 =====
[46.50, 67.26, 52.51, 78.68] 'Qualit<E4>ts Management Center'
[47.12, 77.48, 48.60, 87.89] 'im Verband der Automobilindustrie'
[310.68, -8.50, 378.68, 165.58] '1'
[45.35, 198.98, 54.07, 215.54] 'Qualit<E4>tsmanagement in der Automobilindustrie'
[45.35, 234.92, 65.15, 273.14] 'Dokumentierte Information'
[45.35, 268.92, 60.09, 307.14] 'und Aufbewahrung'
[45.35, 319.35, 51.84, 335.92] 'Leitfaden zur Lenkung und Aufbewahrung von Dokumen<AD>'
[45.35, 336.36, 49.15, 352.92] 'tationen im Rahmen des Produktlebenszyklus <13> insbesondere'
[45.35, 353.36, 52.09, 369.92] 'deren beispielhafte Klassifizierung'
[45.35, 540.86, 51.85, 557.50] '4. vollst<E4>ndig <FC>berarbeitete Ausgabe, August 2018'
[165.52, 559.97, 169.85, 565.52] 'Dokument wurde bereitgestellt vom'
[145.67, 568.97, 149.68, 574.52] 'VDA-QMC Internetportal am 21.01.2019 um 19:33'
===== Search keyword in page 2 =====
[28.35, 412.45, 31.46, 430.29] 'Impressum'
[28.35, 436.95, 30.60, 448.47] 'ISSN'
[113.39, 436.95, 117.89, 448.47] '0943-9412'
[28.35, 447.95, 34.54, 459.47] 'Druck'
[113.39, 447.95, 118.93, 459.47] 'August 2018'
[28.35, 469.95, 33.97, 481.47] 'Copyright 2018<09>'
[113.39, 469.95, 117.99, 481.47] 'Verband der Automobilindustrie e.V. (VDA)'
[113.39, 480.95, 119.58, 492.47] 'Qualit<E4>ts Management Center (QMC)'
[113.39, 491.95, 118.82, 503.47] 'Behrenstra<DF>e 35, 10117 Berlin'
[28.35, 513.95, 34.35, 525.47] 'Gesamtherstellung'
[113.39, 513.95, 119.39, 525.47] 'Henrich Druck + Medien GmbH'
[113.39, 524.95, 118.27, 536.47] 'Schwanheimer Stra<DF>e 110,'
[113.39, 535.95, 117.89, 547.47] '60528 Frankfurt am Main'
[162.68, 557.95, 167.45, 569.47] 'Papier wurde bereitgestellt vom'
[28.35, 557.95, 34.35, 569.47] 'Gedruckt auf chlorfrei gebleichtem Dokument'
[145.67, 568.97, 149.68, 574.52] 'VDA-QMC Internetportal am 21.01.2019 um 19:33'

From the message, you will find the following text line,

[165.52, 559.97, 169.85, 565.52] 'Dokument wurde bereitgestellt vom'

It indicates the position for text line 'Dokument wurde bereitgestellt vom' is "[165.52, 559.97, 169.85, 565.52]", they are the X, Y, Width, Height positions.

2. If you want to remove or replace text at [165.52, 559.97, 169.85, 565.52] position, you can run following command line to overlay a text to that special position,

pdftr.exe -overlaytextbypos "The New Text Contents" -position "165.52, 559.97, 169.85, 565.5" -pages "1-2" D:\test.pdf D:\out.pdf

This command line will overlay "The New Text Contents" to [165.52, 559.97, 169.85, 565.52] position on page 1 and page 2, you can also use -overlaybgcolor, -overlaytextcolor, -overlaytextfontsize, -overlaytextfontname options to set the attributes to the new text string.

You can also use a white rectangle (or other colors) to cover the original text contents, the original text will be hidden by this color block, for example,

pdftr.exe -position "165.52, 559.97, 169.85, 565.52" -overlaybgcolor FF0000 -pages "1-2" D:\test.pdf D:\out.pdf

-overlaytextbypos, -position, -pages are new options in the custom-build version, we hope these functions will useful to you.

image

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!