Wordize for .NET is an efficient solution for text replacement in PDF documents. The Replacer class enables C# developers to programmatically replace text fragments in PDF files using both simple strings and regular expressions.
Key Features:Test the capabilities of programmatic PDF text replacement in the interactive online demo presented on this page. Simply upload your PDF document, specify the search text and replacement text, run the operation, and download the updated file for verification. The provided C# code snippet is ready for use in your .NET project.
using Wordize.Replacing;
Replacer.Replace("Input.pdf", "Output.pdf", "Text or Regex", "Text or Regex");
using Wordize.Replacing;
Replacer.Replace("Input.pdf", "Output.pdf", "Text or Regex", "Text or Regex");
using Wordize.Replacing;
using Wordize.Saving;
var imageStreams = Replacer.ReplaceToImages("Input.pdf",
new ImageSaveOptions(SaveFormat.Pdf), "Text or Regex", "Text or Regex");
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.pdf");
stream.CopyTo(file);
}
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.pdf", "Output.pdf", new Regex(@"Text or Regex"), "Text or Regex", options);
using Wordize.Replacing;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
Replacer.Replace("Input.pdf", "Output.pdf", new Regex(@"Text or Regex"), "Text or Regex", options);
using Wordize.Replacing;
using Wordize.Saving;
FindReplaceOptions options = new FindReplaceOptions() { UseSubstitutions = true };
var imageStreams = Replacer.ReplaceToImages("Input.pdf",
new ImageSaveOptions(SaveFormat.Pdf), new Regex(@"Text or Regex"), "Text or Regex", options);
foreach (var (stream, page) in imageStreams.Select((s, i) => (s, i)))
{
using var _ = stream;
stream.Position = 0;
using var file = File.Create($"Output_{page + 1}.pdf");
stream.CopyTo(file);
}