PDF edit

Hi,

We are going to purchase this tool for one of our client soon, i have downloaded trial version i want to replace particular text in whole pdf document.
I have tried the code from Apose documentation i am getting error for “Runexample” for path, saying object not found.

Please help.

Thanks

@shaikh

Thank you for your interest in our API.

I have worked with the below code snippet from API documentation and it is working fine. You may use below code from this documentation article and modify it as per your requirements. I have attached the source and generated PDF files for your kind reference.
ReplaceTextAll_17.12.pdf ReplaceTextAll.pdf

        // Open document
        Document pdfDocument = new Document(dataDir + "ReplaceTextAll.pdf");

        // Create TextAbsorber object to find all instances of the input search phrase
        TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("text");

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

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

        // Loop through the fragments
        foreach (TextFragment textFragment in textFragmentCollection)
        {
            // Update text and other properties
            textFragment.Text = "TEXT";
            //textFragment.TextState.Font = FontRepository.FindFont("Verdana");
            //textFragment.TextState.FontSize = 22;
            //textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Blue);
            //textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Green);
        }

        dataDir = dataDir + "ReplaceTextAll_17.12.pdf";
        // Save resulting PDF document.
        pdfDocument.Save(dataDir);

You may visit this documentation article to avoid any issue while executing any code snippet from our examples.

Thank you very much, It is working now,
I need to set password how can i achieve it using Aspose PDF.
Thanks

@shaikh

Thank you for your kind feedback.

We are glad to know that your issue is resolved. Please visit this documentation article for your kind reference.

I hope this will be helpful. Please let us know if you need any further assistance.

I have one more concern when i edit the pdf the alignment changes here is the image for reference
code.JPG (14.9 KB)

@shaikh

I would like to request you to always create separate topics for separate issues. Kindly create a new topic while sharing your source and generated PDF file along with a narrowed down code snippet reproducing this issue. Before sharing requested data, please ensure using Aspose.PDF for .NET 18.2 in your environment.