PDA

View Full Version : PDFViewer



DaveR
23-Oct-2024, 04:26 PM
Inspired by today's webinar I thought I'd try a simple Flextron PDFViewer but I get the same issue as in this thread.

https://support.dataaccess.com/Forums/showthread.php?69357-PDFViewer-and-FlexTron&highlight=PDFViewer. DF23

two questions:

Does the advice in the thread still apply? as in drop the following into the oLocalWebAppHost object



Procedure OnDefineScriptIncludes String[] ByRef aScriptHtml
Move @'
<!-- DHTMLX Scheduler -->
<script src="dhtmlx/codebase/dhtmlxscheduler.js" type="text/javascript"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_limit.js"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_units.js"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_timeline.js"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_multiselect.js"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_tooltip.js"></script>
<script src="dhtmlx/codebase/ext/dhtmlxscheduler_minical.js"></script>
<link rel="stylesheet" href="dhtmlx/codebase/dhtmlxscheduler.css" type="text/css">
<script src="dhtmlx/codebase/locale/locale_nl.js"></script>

<script src="Custom/WebDhxScheduler.js"></script>' to aScriptHtml[SizeOfArray(aScriptHtml)]
End_Procedure




and in the Apphtml\Index.htm the script can go anywhere in the <head> section, right?



<!-- WebPdfViewer -->
<script src="PdfViewer/WebPdfViewer.js"></script>
<link rel="stylesheet" type="text/css" href="PdfViewer/WebPdfViewer.css"/>

Harm Wibier
24-Oct-2024, 01:49 AM
With FlexTron the index.html is not used and the main page is generated in memory. So OnDefineScriptIncludes is indeed where you'd add your custom control includes.

wila
24-Oct-2024, 04:51 AM
Dave,

You only need to include the dhtmlx scheduler bits it you actually use the dhtmlx scheduler...

So the code becomes:



Procedure OnDefineScriptIncludes String[] ByRef aScriptHtml
Move @'
<!-- WebPdfViewer -->
<script src="PdfViewer/WebPdfViewer.js"></script>
<link rel="stylesheet" type="text/css" href="PdfViewer/WebPdfViewer.css"/>' to aScriptHtml[SizeOfArray(aScriptHtml)]
End_Procedure


--
Wil

DaveR
24-Oct-2024, 08:08 AM
This morning that seems obvious... :o thanks gents
Yesterday I was mostly talking to electrical and construction project managers about two new stores so my head was not in the dataflex game...

I have to say my early impressions of Flextron were wrong, it seems to be almost endlessly flexible; but it probably warrants a more complete review of that brief help page.

DaveR
25-Oct-2024, 01:16 PM
NVM - found a slash where a backslash should be

DaveR
29-Oct-2024, 01:06 PM
A follow-up question, if I may.

I have this working beautifully, displaying a bunch of .PDF files currently located under a folder under Apphtml, as per example.

What's the best way to have it get the pdfs from another source, in fact another server, where my users can add what they want to publish?

It isn't by setting psResourceUrl and psUploadURL in oLocalWebResourceManager or at least it isn't the way I'm doing it though from the class it looks like it should be...(the released help has some interesting additional properties but it didn't seem to be them
either, online docs has fewer properties and at least has some descriptions)


Object oLocalWebResourceManager is a cLocalWebResourceManager
String sPath
// Move (fPathKF("PATHDOCS")) to sPath
// Set psResourceUrl to sPath //\\KFP-AIO\HOME\FC\LUCIE\USERS\KFDocuments\
// Set psUploadUrl to sPath
Set psResourceUrl to "\\KFP-AIO\HOME\FC\LUCIE\USERS\KFDocuments\" // Relative URL to the Resource Handler ASP
Set psUploadUrl to "\\KFP-AIO\HOME\FC\LUCIE\USERS\KFDocuments\" // Relative URL to the file upload ASP
End_Object


and Send SetVirtualHostNameToFolderMapping in my OnLoad doesn't help either.

Suggestions please? For now I can live with the folder under Apphtml but at some point I'm going to be asked to make the folder available to users to maintain.

I suppose I'm really asking how to make an absolute UNC path appear as a relative one when there's a change of servers?

Harm Wibier
30-Oct-2024, 03:03 AM
Hi Dave,

The cLocalWebResourceManager mimics the functionality of the cWebResourceManager in an actual WebApp. So the idea is that that you use Get DownloadUrl to generate a file streaming URL for a local file path. The psResourceUrl and psUploadUrl are virtual url's within the system and unless you want to change the inner workings of the resource manager it is not recommended to change them.

Regards,

DaveR
30-Oct-2024, 03:59 AM
Hi Dave,

The cLocalWebResourceManager mimics the functionality of the cWebResourceManager in an actual WebApp. So the idea is that that you use Get DownloadUrl to generate a file streaming URL for a local file path. The psResourceUrl and psUploadUrl are virtual url's within the system and unless you want to change the inner workings of the resource manager it is not recommended to change them.

Regards,

thanks Harm,


I had tried and given up on that already, but revisited it


Object oLocalWebResourceManager is a cLocalWebResourceManager
Set pbAllowInvalidDownloadUrl to True
Set pbAllowUnregisteredFolders to True
End_Object


and then


Procedure OnRowClick String sRowId Integer iColumnIndex
String sDoc sURL
Move (fPathKF("PATHDOCS")) to sPath
Move (Trim(DOCUMENTS.document)) to sDoc
Get DownloadURL of oLocalWebResourceManager (sPath+sDoc) to sURL
WebSet psURL of oPDFViewer to sURL
End_Procedure


works apparently perfectly. Thanks very much for the insight