[pdfJS Viewer Reactive] pdf filename is document.pdf when downloading (looking to pass a filename)
pdfjs-viewer-reactive
Reactive icon
Forge component by Eduardo Jauch

Hi,

For the [pdfJS Viewer Reactive] component, I'm looking for a way to pass a FileName value into the component so that my download is named MyFileName.pdf instead of document.pdf. Can anyone help me out?


Yes If the URL we pass is in below format than it picks the name automatically by using regex otherwise it download with name document.pdf

http://domain.com/path/to/Named.pdf
http://domain.com/path/to/your/api?fileId=123&saveName=Named.pdf

Hi Gwen ,

What is your URL input to the pdfJSViewer widget?  Please check below link file is downloading with the actual file name 

https://dbaghel.outsystemscloud.com/testChart/screen1

Best Regards

Devendra


Hi Devendra, 

When I created my questions, my URL input was "/KZ_FileCache_CS/rest/FileStorage/GetFile?Id=" + FileCache_Create.FileCacheId

as I said in the previous post, adding &saveName=FileName did the trick. What was it you wanted to propose? I see your solution works as well, is the solution similar, or do you have anything else to share which might be useful to know?

sorry for answering my own question :-) , but I just found something that works : 

I was reading this, since it's the component uses the same js if I'm not mistaken (quite clearly mentionned in its name)

https://stackoverflow.com/questions/24457064/mozilla-pdf-js-how-to-i-specify-the-filename-for-download

so I tried the suggested answer, which is to make sure the URL looks like this

http://domain.com/path/to/your/api?fileId=123&saveName=Named.pdf

So for us, we just added &saveName=FileName, which works perfectly to download FileName.pdf instead of document.pdf

"/KZ_FileCache_CS/rest/FileStorage/GetFile?Id=" + FileCache_Create.FileCacheId + "&saveName=" + FileName

Yes If the URL we pass is in below format than it picks the name automatically by using regex otherwise it download with name document.pdf

http://domain.com/path/to/Named.pdf
http://domain.com/path/to/your/api?fileId=123&saveName=Named.pdf
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.