Print to PDF issues for large documents

I have a process that opens an email, prints it to PDF and then opens the PDF. I inserted a 10 second delay after print to allow for the printing to finish.

My issue is that in some cases, the email are large or there are network issues that cause the print to take >10 seconds. When the print is >10 seconds, the process continues but it causes an error since Adobe can’t open a file that is being printed.

In most cases the print window dialog is visible only for about 1 or 2 seconds. Ideally, when the print process is finished the process should continue but it is ok if the process waits another 10 seconds.

I don’t know how to test/trap that a PDF is still being printed.

Any ideas?

Hi
Welcome to uipath community
So we use print option to save those email as a pdf right
Cheers @ivanc

Yes, that’s what I am doing.

Great
So in that case
Before to the printing process and it’s relevant activity use a assign activity like this
list_filepath = Directory.GetFiles(“yourfolderpath”,”*.pdf”).ToList

Where list_filepath is a variable of type System.Collections.Generic.List(of string) defined in the variable panel with default value as New List(of string)

Now use another assign activity like this after the printing activity
list_filepath_1= Directory.GetFiles(“yourfolderpath”,”*.pdf”).ToList

Same where list_filepath_1 is a variable of type System.Collections.Generic.List(of string) defined in the variable panel with default value as New List(of string)

So Followed by that now use a IF condition like this
list_filepath_1.Count > list_filepath

If this is true it will go to THEN part where keep your further activities in your current sequence
Or
if that fails it will go to ELSE part where use a delay of 00:00:30 seconds and then keep the remaining sequence of activities

Hope this would help you
Cheers @ivanc

Ohh that’s clever! I like it.

1 Like

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