Link Search Menu Expand Document

Fix Text Alignment Issue

Users may have encountered an issue when using the /pdf/edit/replace-text API endpoint to replace text in a PDF document. The replaced text might appear slightly higher than the original text or the surrounding text, causing alignment issues.

To fix this issue, we have added a new parameter called YAdjustmentForReplacementText in the profiles parameter of the API request. This parameter allows you to adjust the vertical position of the replaced text, ensuring proper alignment with the rest of the document.

Here’s an example of how to use the YAdjustmentForReplacementText parameter:

"profiles": "{'YAdjustmentForReplacementText': '-1'}"

Example API Request:

POST /pdf/edit/replace-text

{
  "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-to-text/sample.pdf",
  "searchString": "200.00",
  "replaceString": "600.00",
  "caseSensitive": true,
  "replacementLimit": 1,
  "pages": "",
  "password":"",
  "name": "Output",
  "async": false,
  "profiles": "{'YAdjustmentForReplacementText': '-1'}"
}

In this example API request, the YAdjustmentForReplacementText parameter has been set to -1, which moves the replaced text 1 unit up vertically, resulting in better alignment with the original text or surrounding text.

Adjusting the YAdjustmentForReplacementText Value

Depending on your specific document and font, you might need to adjust the YAdjustmentForReplacementText value to achieve the desired alignment. Positive values will move the replaced text down, while negative values will move it up. Experiment with different values until you find the optimal alignment for your document.

Remember that this parameter should be added within the profiles parameter, as shown in the example API request above.

By utilizing the YAdjustmentForReplacementText parameter, you can ensure that your replaced text aligns properly with the rest of your PDF document, resulting in a more polished and professional appearance.