Modify the PDF

Hi Team,

we have multiple pages invoice(PDF) i want modify the invoice means remove some data and replace the data for all pages.
please give the solution on this.

@AsadPathan2665

There are no direct activities available for the same

you might need to use your own code to do so

where most of the cases you might loose the orientation and pagelayout

cheers

1 Like

@AsadPathan2665 There are no activities which can help you with this task.

You can use Python or .net code to do the same and invoke same in UiPath using invoke code.

can you please share the code

can you share exact requirement with sample pdfs

Hi @MohammedShabbir,
PFA sample PDF and we want to change the name of Tax Invoice
Original For Recipient and remove the Invoice No and remove the value of USD rate column value.
REPORT_102_-_DYNAMIC_INVOICE_2024-12-16_1444.pdf (184.0 KB)

Hi @MohammedShabbir,
any way to modify ?

You can follow approaach like,

  1. Read PDF using pdf activties.
  2. Replace text using regex with the required data, like
    Eg : ModifiedText = pdfText _ .Replace(“Tax Invoice” +Environment.NewLine+“Original For Recipient”,NewTitleArgument) _
    .Replace(“Invoice No” + Environment.NewLine + “Null”, “”) _
    .Replace(“Invoice No”, “”) _
    .Replace(“USD RATE”, “USD RATE”)
  3. Replace amount :
    ModifiedText = Regex.Replace(ModifiedText, “\s\d+.\d{2}”, “”)
  4. Create a .docx template
    Write text using “Write Text File” and then convert this docx to PDF
    This is more stable. Hope this design helps.

Hi @MohammedShabbir,
i will try this approach and let you know.

Hi @MohammedShabbir,
how we can keep the format as it is after save the docs to pdf?