PDF files in forms

Hi, I’m trying to build a form in which a user can select a pdf file which will then be displayed in the form. I’m using an iframe in an HTML Element Component:

The src attribute of the iframe is defined as:
/file://localPathToTheFile

This does work as long as there are no spaces in the path to the pdf file, e.g.:
/file://c:\path\abc.pdf - works
/file://c:\path\a bc.pdf - does not work

I’ve tried to properly encode the URI with the encodeURI function, but this did not help. Does anyone know how to encode the src attribute of the iframe to allow spaces? Or is there a better approach to display pdf files in the form?

Here is the form I’ve implemented so far: Test.xaml (13.2 KB)

2 Likes

Hi @SK1,
I might be wrong but probably this behavior is due to the escape character. Have you tried to use it for the empty space?

1 Like

Not sure which escape character you are referring to. I’ve tried to replace the space with %20 but this did not work. Is UiPath using a special escape character to allow spaces in a file path?

Not sure if I’m right but for iframes from what I remember the escape character is "\" but I’m not sure if it’s applicable here.

I’ve tried replacing the whitespace with either “/” or “\”, and ecaping it with "/ " or "\ ". None of those 4 variations worked.

I see. Hmm to be honest right now I’m not sure if we should consider it as a bug or I don’t know something. Let’s add @Tamilselvan here :slight_smile: Hopefully he will help here.

I confirmed that when you try to get /file://c:\path\a bc.pdf, what it actually gets
is c:\path\a%20bc.pdf meaning that the space is URL encoded.
Because of this, I believe with the current design, adding space as part of the path is not possible.
I have raised this issue to the devs.

1 Like

Hi @Yoshi_Akiyama - This should no longer be an issue if you have the latest Forms Activity Package - version 1.3. Thanks!

See Release notes

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