How to rename each PDF by start number 1?

I want to extract each pages of the 2 below PDF and numbering the PDF

POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf (this PDF contains 3 pages)

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf (this PDF contains 6 pages)

I’m able to extract each pages but the numbering is 1 to 9
When I want 1 to 3 and for the 2nd PDF 1 to 6

How to instruct the bot to rename the PDF as follow?

POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf_1.pdf

POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf_2.pdf

POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf_3.pdf

And

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_1.pdf

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_2.pdf

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_3.pdf

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_4.pdf

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_5.pdf

POSEIDON PERSONEESL SERVICE SA FDS 17-18 SEPT 2022.pdf_6.pdf

Thanks in advance for your help.
Maic

Hi @mce

You can use the “Get PDF Page Count” activity to get the total pages in a pdf.
Then create a loop from 1 - range, and you use the “ Extract PDF Page Range” to extract that specific page.
Use the loop index when you specify the name for output file.

Hi @mce

Please check the below workflow

I have attached the xaml for your reference
Main.xaml (18.6 KB)

Regards

As a variation find below starter help:

NewFileName =

String.Format("{0}_{1}.pdf", Path.GetFileName(strPDFFullFilePath), CurrentItem.ToString)

set the variable: strPDFFullFilePath to the FullFilePath of the processed PDF

we use for the new name the appending of _X.pdf to the old name
We can also generate a different name eg.

abc.pdf → abs_X.pdf etc

Find starter help here:
ppr-Recipe_SplitPDF_PageByPage.xaml (14.6 KB)

Hey thanks @Sharath_HK thanks it works however when using the loop index it start with numbering 0 instead of 1. Do you know why?

the naming is like that POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf_0.pdf
when I want to start by 1. So like that => POSEIDON PERSONEESL SERVICE SA FDS 15-16 SEPT 2022.pdf_1.pdf

Do you know how to proceed?

index is 0 based

(idxVar + 1).toString

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.