Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
Gnostice Document Studio .NET |
PDFOne .NET |
Gnostice Document Studio Java |
PDFOne (for Java) |
Gnostice Document Studio Delphi |
eDocEngine VCL |
PDFtoolkit VCL |
StarDocs Web APIs |
IntraWeb which is bundled with Delphi contains powerful components and controls making it easy to develop web applications. IntraWeb is designed to leverage your native Delphi development skills and take them to the web. In this article we'll show you how to create a simple web application to view multiformat documents stored on the server using Gnostice StarDocs APIs. The demo will simulate how a banking application can enable customers to view their statements online.
This article uses the Delphi 10.1 Berlin IDE with bundled IntraWeb XIV. However you should be able to follow it for earlier versions of Delphi as well down to Delphi XE7 (StarDocs SDK is supported only from XE7 onward).
Here is a short videos covering the topic if you'd prefer watching over reading! However we suggest you also read the article.
ServerController.pasfile.
// ... uses ..., gtxStarDocsSDK; // ... type TIWServerController = class(TIWServerControllerBase) //... procedure IWServerControllerBaseCreate(Sender: TObject); //... public StarDocs: TgtStarDocsSDK; // ... procedure TIWServerController.IWServerControllerBaseCreate( Sender: TObject); begin // Set up connection details StarDocs := TgtStarDocsSDK.Create(nil); StarDocs.ConnectionSettings.ApiServerUri := 'http://api.gnostice.com/stardocs/v1'; StarDocs.ConnectionSettings.ApiKey := '<API Key>'; StarDocs.ConnectionSettings.ApiSecret := '<API Secret>'; // Force full permissions on PDF files protected // with an permissions/owner/master password StarDocs.Preferences.DocPasswordSettings.ForceFullPermission := True; // Authenticate StarDocs.Auth.loginApp; end;
// type // TIWForm1 = class(TIWAppForm) private SelectedFile: string; // end; // ... uses ServerController; procedure TIWForm1.IWAppFormCreate(Sender: TObject); var DocsPath: string; begin DocsPath := ServerController.IWServerController.ContentPath + 'docs\'; IWListbox1.Items.AddPair('Bank Statement #1', DocsPath + 'statement1.pdf'); IWListbox1.Items.AddPair('Bank Statement #2', DocsPath + 'statement2.pdf'); IWListbox1.Items.AddPair('Bank Statement #3', DocsPath + 'statement3.pdf'); SelectedFile := '-1'; end;
ServerController.IWServerController.ContentPathpoints to the server deployment home folder (wwwroot). In the development environment this will be
<debug-folder>\wwwrootor
<release-folder>\wwwrootbased on the build configuration. Create a folder called docs there and place a few PDF files under it titled 'statement1.pdf', 'statement2.pdf' and 'statement3.pdf'.
procedure TIWForm1.IWListbox1AsyncChange(Sender: TObject; EventParams: TStringList); begin SelectedFile := EventParams.ValueFromIndex[0]; end;
uses gtxStarDocsSDK; // ... procedure TIWForm1.IWButton1Click(Sender: TObject); var StarDocs: TgtStarDocsSDK; // A copy, so don't free it here! DocObject: TgtDocObject; ViewResponse: TgtCreateViewResponse; begin DocObject := nil; ViewResponse := nil; if SelectedFile <> '-1' then begin DocObject := nil; ViewResponse := nil; try // Load file in viewer StarDocs := ServerController.IWServerController.StarDocs; // Upload file DocObject := StarDocs.Storage.Upload(SelectedFile , ''); ViewResponse := StarDocs.Viewer.CreateView(DocObject, ''); // Launch browser pointing to the view url IWURLWindow1.URI := ViewResponse.Url; finally if Assigned(ViewResponse) then FreeAndNil(ViewResponse); if Assigned(DocObject) then FreeAndNil(DocObject); end; end; end;
Note that the viewer can be customized as per your need. For this please see our related article Viewing PDF and image files in your web apps using Web APIs.
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |