How to Search and Replace Text and Set Text Alignment

How to Search and Replace Text and Set Text Alignment

As PDF documents are not designed to be editable, there is no text alignment inside. Every text line is in fixed position. So, when you use search and replace, the replacement text will be placed in the same position as the original string.

To get the text aligned, you need to remove unwanted text using /v1/pdf/edit/delete-text endpoint, then add new text with alignment using /v1/pdf/edit/add endpoint.

Zapier

You can remove the unwanted text using PDF.co Custom API Call and v1/pdf/edit/delete-text endpoint. And, you can add the new text using the PDF.co PDF Filler action.

For this text you need to specify width of the text box equal to the width of PDF page and add center alignment option.

In this example, 842 is page width of A4 format:

0;50;0;2138 Dawson Drive, Little Rock, Arkansas, 72211;8;Helvetica;000000;;false;842;20;center

Applies To:

  • /pdf/edit/add
  • /pdf/edit/delete-text
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.