Can I intreate a pdf view inside a parasql web app?

25 views
Skip to first unread message

Kim Sokil

unread,
Nov 21, 2017, 12:18:46 PM11/21/17
to ParaSQL Support
What I would like to know is there a way to integrate a PDF viewer into a web page?
Example:  have a list of document records on the left hand of the screen - if I click on a document (field) then I want to be able to have a quick view of that document on the left hand side of the page.  Very similar to Windows Explorer views.
I do not want to open up a new web tab.
Our users are looking for a quick search without opening and closing tabs.

Thanks
Kim
Message has been deleted

Robert

unread,
Nov 21, 2017, 3:54:47 PM11/21/17
to ParaSQL Support
You can also do it by adding a completely empty HTML widget, and then add an Event that fires when it renders (click Events on the toolbar).... the event code would be something like this (it is pulling the file dynamically from the server, so this can be very slow if the document is large or there are several documents being shown):

function (event) {

getPdfDocument(event);

}

And the function getPdfDocument in your script library might look like this:


// called by render event on HTML Widget for a PDF Viewer
getPdfDocument = function(event) {
var docFieldDataValue = parasql.app.getWidgetById('ID9070').getDataValue();
if (docFieldDataValue && docFieldDataValue.isNotNull()) {
var objectName = docFieldDataValue.getBlobObjectName();
parasql.util.sendAjaxMessage( { header:'X-ParaSQL-AJAX-GetSignedDownloadURL', 
object: { objectName: objectName },
action: getPdfDocumentResponse } );
parasql.ui.WaitPanel.show();
}
}

/**
 * AJAX callback method.
 * @param {string} jsonText
 */
getPdfDocumentResponse = function(jsonText) {
parasql.ui.WaitPanel.hide();
/**
* @type {parasql.util.JsonResponse}
*/
var result = parasql.util.deserializeJsonResponse(jsonText);
if (result.status == 'OK') {
var downloadURL = result.data;
var htmlWidget = parasql.app.getWidgetById('ID9073');
htmlWidget.getContentDiv().innerHTML = "<div style='line-height:1.2em; height:95%; border:none; box-sizing:border-box;'><embed src='"+
downloadURL+"' width='100%' height='100%' statusbar=0' type='application/pdf'></div>";
} else {
new parasql.ui.MessagePanel('Error Retrieving Signed Download URL', 
'Contact ParaSQL for support.', result.errorMessage).show();
}
}



Kim Sokil

unread,
Nov 22, 2017, 1:25:00 PM11/22/17
to ParaSQL Support
I have put this code in an HTML block (draged over the HTML button).
Nothing shows up, no pdf no error message.  In the example you have a field for the URL - I do not have one. Do I need this?  how do I get one?  and how does it attach to the record?
So excited about this....


<div style='position: relative; width: 100%; height: 100%; overflow: hidden;'>

<object data="@value(Sokil_Order_Documents.Document)" type="application/pdf" width="98%" height="98%">
<iframe src="@value(Sokil_Order_Documents.Document)" style=border: none; width="98%" height="98%" 
style='position: relative; width: 100%; height: 100%; 
   box-sizing: border-box; background-color:transparent' frameborder='0' seamless>

</iframe></object></div>
Reply all
Reply to author
Forward
0 new messages