[RPG]No cache for PDF in webview element

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

[RPG]No cache for PDF in webview element

Post by MegumiSawada »

Hi,

I would like to displya PDF on webview element on the formview.
The PDF files are stored in IBM i's IFS, under LongRange Resource folders.

When the PDF is displayed in the LongRange app,I want that the current version of the PDF is shown. If the target PDF has been deleted since last displayed, I would like to show no PDF. I don't want to use local cashe to show PDFs.

How could it be done in LongRange?
Is tehre any setting or property to be used?

I appreciate your kind advice.

Best Regards,
Megumi Sawada
jasonzhou
Posts: 130
Joined: Wed Jan 11, 2017 3:26 pm

Re: [RPG]No cache for PDF in webview element

Post by jasonzhou »

Please try to set the Cache-Control header to "no-cache" for pdf file. This should work.
MegumiSawada
Posts: 268
Joined: Tue Feb 19, 2013 5:18 pm

Re: [RPG]No cache for PDF in webview element

Post by MegumiSawada »

Hi Jason,

Do you mean I need to set Cache-Control header to "no-cache" for PDF file itself?
I don't know how to do it...
Could you please let me know how to?

Best Regards,
Megumi
jasonzhou
Posts: 130
Joined: Wed Jan 11, 2017 3:26 pm

Re: [RPG]No cache for PDF in webview element

Post by jasonzhou »

Hi Megumi,

Another way is to set the CachePolicy property of Webview, below is an example for your reference.

Code: Select all

#COM_OWNER.set Property('/Form.Fields.Webview1.url') To("http://10.2.1.101/test.pdf")
#COM_OWNER.set Property('/Form.Fields.Webview1.CachePolicy') To("nocache")
It works only for current URL set for webview, if the pdf file is navigated from another page, the system will still cache it.

If this property doesn't satisfy your needs, you have to set the Cache-Control header on server, if so, I will show you how to do it.
Post Reply