Unable to save Word Document as PDF

Hi Team,

i have situation where i am trying to save document as pdf. i have different method but it is not working for me it seems.

when i open the word document, there will be one pop-up which i need to close and that is working fine using check app state activity and close or click activity, but in case if pop up doesn’t appear it should save that word document as PDF

Hi @Rakesh_Tiwari
Welcome to the community,

See there is two approach

  1. Currently you are using Check App State so after that add 2-4 sec of delay and apply the logic like if target appear then click and close the popup and save the file as .pdf
  2. If target does not appear then directly save the file

Another approach

  1. Use Element Exists activity to check for pop-up

  2. Store result in a Boolean variable

  3. Use If activity
    If popupExists = True β†’ Close pop-up
    If does not exist then
    popupExists = False β†’ Skip

  4. Save Word document as PDF

If it’s helpful please mark as solution
Thanks

1 Like

Hi @Rakesh_Tiwari

Welcome to UiPath community

Use Check App State correctly:

  • Target exists (popup appears) β†’ popup Close or click β†’ Save as PDF
  • Target does NOT exist (popup doesn’t appear) β†’ Directly Save as PDF

Put Save as PDF activity inside both branches (or after Check App State).

Regards
Gokul

1 Like

Thanks for the reply..
but, my problem is first i opened the word application scope and passed the path, after that i am checking the pop up using check app state, if appear it will close in Target appear section, but it not appear it will go to target doesn’t appear section where i kept save document as pdf, but it says i need to keep the document in word application scope and when i pass again, bot say already open document can not open again.

Hi @Rakesh_Tiwari

Word Application Scope (Document Path)
└── Check App State (Popup)
β”œβ”€β”€ Target Appears
β”‚ β”œβ”€β”€ Close Popup
β”‚ └── Save Document as PDF
└── Target Does Not Appear
└── Save Document as PDF

  • One document β†’ one Word Application Scope
  • All actions (popup handling + save PDF) stay inside it

Regards
Gokul

1 Like

@Rakesh_Tiwari
Check first approach
Thanks

1 Like

This will work only in Word Application Scope. Place all activities inside this.
Check app state will not work here.

1 Like

Hi @Rakesh_Tiwari

Use Check App State or Element Exists to detect the pop-up. If it appears, close it; if not, proceed to save the Word document as PDF using Word Application Scope.

1 Like

@Rakesh_Tiwari

Better you use Word activity - Activities - Save Document as PDF

Feel free to ask if any question or issue.

2 Likes

Why are you opening the Word document? Just use the Save Document as PDF activity that’s in the UiPath.Word.Activities library.

1 Like

Hi @Rakesh_Tiwari

Use a conditional flow to handle the pop-up:

  1. Open the Word document.

  2. Check for the pop-up with Check App State.

    • If it exists, close it.
    • If not, continue.
  3. Save the document as PDF using Word Application Scope β†’ Export To PDF.

This ensures the PDF save runs whether the pop-up appears or not.

1 Like

Anything related to Microsoft products, Word, Excel, Outlook etc.. use coded workflow and Microsoft.Office.Interop. Using UiPath activites probably save you some time now, but in long run, it’s beneficial if you use .Net native methods.

2 Likes

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