Regarding the removal of spaces between contents when using Contents Replacer


If I replace a content using Contents Replacer, then I get to have a space between a replaced content and a following sentence.

I assume that it would be pushed back by the amount of contents when trying to replace contents by using Contents Replacer. So, isn’t the space filled up by the amount of replaced contents in case there are any spaces? Also is there any way to remove spaces either with Contents Replacer or with a different method?

Here’s the source for your information. Also I have two files attached.

Thank you.

using pdftron.PDF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ContentReplacerTest
static class Program
static void Main()
var filePath = ‘test.pdf’;
using (PDFDoc doc = new PDFDoc(filePath))
ContentReplacer replacer = new ContentReplacer();
replacer.AddString(‘H’, ‘Z’);
var page = doc.GetPage(1);
doc.Save(‘result.pdf’, pdftron.SDF.SDFDoc.SaveOptions.e_compatibility);

result.pdf (37.6 KB)

test.pdf (35.4 KB)

The output you get is the expected result using that code.

It would be best if you explained exactly what you are trying to accomplish, preferably with some sort of image/screenshot showing what you get, and another showing what want to get.