Skip to content

Commit d3fef96

Browse files
File are modified based on WebApi
1 parent 9eacd1f commit d3fef96

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

src/app/app.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
</div>
55
<br />
66

7-
<ejs-dialog id='openFileDialog' showCloseIcon='true' height='100%' width='100%' visible='false' isModal='true' >
8-
<!-- <ng-template #header>
9-
File Manager with PDF Viewer
7+
<ejs-dialog id='openFileDialog' showCloseIcon='true' height='100%' width='100%' [visible]=false isModal='true' >
8+
<ng-template #header>
9+
Open PDF, Word, and Excel files
1010
</ng-template>
1111
<ng-template #content>
1212
<div class="dialogContent">
@@ -26,5 +26,5 @@
2626
<ejs-spreadsheet> </ejs-spreadsheet>
2727
</div>
2828
</div>
29-
</ng-template> -->
29+
</ng-template>
3030
</ejs-dialog>

src/app/app.component.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import { DialogComponent } from '@syncfusion/ej2-angular-popups';
1010
})
1111
export class AppComponent {
1212
title = 'file-manager-integration';
13-
public hostUrl: string = 'https://ej2-aspcore-service.azurewebsites.net/';
13+
public hostUrl: string = 'https://localhost:44352/';
1414
public ajaxSettings: object = {
15-
url: this.hostUrl + 'api/FileManager/FileOperations'
15+
url: this.hostUrl + 'api/FileManager/FileOperations',
16+
getImageUrl: this.hostUrl + 'api/FileManager/GetImage',
17+
uploadUrl: this.hostUrl + 'api/FileManager/Upload',
18+
downloadUrl: this.hostUrl + 'api/FileManager/Download'
1619
};
20+
1721
public service = 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer';
1822
public document = 'PDF_Succinctly.pdf';
1923
public docContainer: DocumentEditorContainerComponent | undefined;
2024
public dialog : DialogComponent | undefined;
2125

22-
public ngOnInit(): void {
23-
this.dialog?.hide();
24-
}
25-
2626
fileOpen(args: FileOpenEventArgs) {
2727
const fileDetailsObj: any = args.fileDetails!;
2828
let fileName: string = fileDetailsObj["name"];
@@ -31,8 +31,8 @@ export class AppComponent {
3131

3232
if (fileType == '.pdf') {
3333
let responseText: any = this.getFileStream(filePath, true);
34-
var pdfviewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];
35-
pdfviewer.load(responseText, null);
34+
// var pdfviewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0];
35+
// pdfviewer.load(responseText, null);
3636
}
3737
else if (fileType == '.docx') {
3838
// let responseText: any = this.getFileStream(filePath, false);
@@ -55,7 +55,16 @@ export class AppComponent {
5555
ajax.onreadystatechange = () => {
5656
if (ajax.readyState === 4) {
5757
if (ajax.status === 200 || ajax.status === 304) {
58-
return ajax.responseText;
58+
if (!isPDF) {
59+
// open SFDT text in document editor
60+
// this.container.documentEditor.open(ajax.responseText);
61+
} else {
62+
var pdfviewer = (<any>document.getElementById('pdfViewer'))
63+
.ej2_instances[0];
64+
pdfviewer.load(ajax.responseText, null);
65+
//opens the file in pdf viewer
66+
//this.pdfView.load(ajax.responseText, null);
67+
}
5968
}
6069
}
6170
return null;

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>FileManagerIntegration</title>
5+
<title>File Manager Integration with PDF, Excel, and Word documents</title>
66
<base href="/">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<link rel="icon" type="image/x-icon" href="favicon.ico">

0 commit comments

Comments
 (0)