PDF Edit with Keeping Layout

sample- convert - doc.pdf (868.9 KB)
Hi
We are working on a project for the local body to convert existing purcahse orders/ ivoices etc… to a digital library system, For this existing orders are in pdf format but are in local language
we want to convert same to key english , (for which we have created a dictionary). We want to keep the same pdf along but words in english but keeping same layout and images, In short we want to replace local language text in attached pdf with english key words. How can this be achieved using aspose.pdf tool kit,

@bosecs

Thanks for contacting support.

You may please use Text Replace functionality offered by Aspose.PDF in order to convert/replace non-English language into English. Please check following sample code snippet which can help you implementing the functionality.

Document doc = new Document(dataDir + "input.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(".+", new TextSearchOptions(true));

// Accept the absorber for all the pages
doc.Pages.Accept(textFragmentAbsorber);

// Get the text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

// Loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
  if (textFragment.Text == " " || textFragment.Text == "")
      continue;
  // Create new text fragment with updated string that contains all necessary newline markers
  string updatedText = TranslateText(textFragment.Text); // This is your method which will translate given text.
  TextFragment updatedFragment = new TextFragment(updatedText);
  textFragment.Text = updatedFragment;
}

In case you face any issue, please let us know by sharing a sample project including all necessary files and data. We will test the scenario in our environment and address it accordingly.