Skip to content

Commit f402b44

Browse files
authored
Merge pull request #65 from SyncfusionExamples/EJ2-931372
931372: Adding a Custom Feature for Attaching Files to PDFs
2 parents fb735ef + 1203635 commit f402b44

31 files changed

+6313
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Attachpdf
2+
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.11.
4+
5+
## Development server
6+
7+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
8+
9+
## Code scaffolding
10+
11+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
13+
## Build
14+
15+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16+
17+
## Running unit tests
18+
19+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
21+
## Running end-to-end tests
22+
23+
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
24+
25+
## Further help
26+
27+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"attachpdf": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/attachpdf",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
"src/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/styles.css"
29+
],
30+
"scripts": []
31+
},
32+
"configurations": {
33+
"production": {
34+
"budgets": [
35+
{
36+
"type": "initial",
37+
"maximumWarning": "500kb",
38+
"maximumError": "1mb"
39+
},
40+
{
41+
"type": "anyComponentStyle",
42+
"maximumWarning": "2kb",
43+
"maximumError": "4kb"
44+
}
45+
],
46+
"outputHashing": "all"
47+
},
48+
"development": {
49+
"buildOptimizer": false,
50+
"optimization": false,
51+
"vendorChunk": true,
52+
"extractLicenses": false,
53+
"sourceMap": true,
54+
"namedChunks": true
55+
}
56+
},
57+
"defaultConfiguration": "production"
58+
},
59+
"serve": {
60+
"builder": "@angular-devkit/build-angular:dev-server",
61+
"configurations": {
62+
"production": {
63+
"browserTarget": "attachpdf:build:production"
64+
},
65+
"development": {
66+
"browserTarget": "attachpdf:build:development"
67+
}
68+
},
69+
"defaultConfiguration": "development"
70+
},
71+
"extract-i18n": {
72+
"builder": "@angular-devkit/build-angular:extract-i18n",
73+
"options": {
74+
"browserTarget": "attachpdf:build"
75+
}
76+
},
77+
"test": {
78+
"builder": "@angular-devkit/build-angular:karma",
79+
"options": {
80+
"polyfills": [
81+
"zone.js",
82+
"zone.js/testing"
83+
],
84+
"tsConfig": "tsconfig.spec.json",
85+
"assets": [
86+
"src/favicon.ico",
87+
"src/assets"
88+
],
89+
"styles": [
90+
"src/styles.css"
91+
],
92+
"scripts": []
93+
}
94+
}
95+
}
96+
}
97+
},
98+
"cli": {
99+
"analytics": "75704c67-92cb-4192-8fe2-264e6202c84f"
100+
}
101+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "attachpdf",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^15.2.0",
14+
"@angular/common": "^15.2.0",
15+
"@angular/compiler": "^15.2.0",
16+
"@angular/core": "^15.2.0",
17+
"@angular/forms": "^15.2.0",
18+
"@angular/platform-browser": "^15.2.0",
19+
"@angular/platform-browser-dynamic": "^15.2.0",
20+
"@angular/router": "^15.2.0",
21+
"@syncfusion/ej2-angular-buttons": "*",
22+
"@syncfusion/ej2-angular-navigations": "*",
23+
"@syncfusion/ej2-angular-pdfviewer": "*",
24+
"@syncfusion/ej2-pdf": "*",
25+
"rxjs": "~7.8.0",
26+
"tslib": "^2.3.0",
27+
"zone.js": "~0.12.0"
28+
},
29+
"devDependencies": {
30+
"@angular-devkit/build-angular": "^15.2.11",
31+
"@angular/cli": "~15.2.11",
32+
"@angular/compiler-cli": "^15.2.0",
33+
"@types/jasmine": "~4.3.0",
34+
"jasmine-core": "~4.5.0",
35+
"karma": "~6.4.0",
36+
"karma-chrome-launcher": "~3.1.0",
37+
"karma-coverage": "~2.2.0",
38+
"karma-jasmine": "~5.1.0",
39+
"karma-jasmine-html-reporter": "~2.0.0",
40+
"typescript": "~4.9.4"
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
@NgModule({
7+
imports: [RouterModule.forRoot(routes)],
8+
exports: [RouterModule]
9+
})
10+
export class AppRoutingModule { }

How to/Add a Custom Feature for Attaching Files to PDFs/Attaching Files to PDFs/src/app/app.component.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<ejs-sidebar *ngIf="!isMobile" id="defaultSidebar" #sidebar cssClass="e-outline" class="e-pv-e-sign-default-sidebar" width="200px" position="Left" [enableGestures]="false">
2+
<div class="e-pv-e-sign-content content-wrapper" style="margin: 7px;">
3+
<div style="font-weight: 500; font-size: 16px; width: 43px; height: 24px; margin: 15px 10px 5px;">
4+
Fields
5+
</div>
6+
<ejs-dropdownlist #userMenu id="e-pv-e-sign-employees" [dataSource]="userDetails" index = 0
7+
[fields]="fields" (select)="userChange($event)" [popupHeight]="height">
8+
<ng-template #itemTemplate let-data>
9+
<div style="display: flex; height: 50px; width: 200px;">
10+
<img class="e-pv-e-sign-empImage" height="30px" width="30px"
11+
style="margin: 10px 6px; border-radius: 50%"
12+
[ngStyle]="{'border': '1px solid ' + (data.Mail === 'andrew@mycompany.com' ? 'red' : 'green')}"
13+
src="https://ej2.syncfusion.com/angular/demos/assets/pdf-viewer/employees/{{data.Eimg}}.png"
14+
alt="{{data.Eimg}}" />
15+
<div>
16+
<div class="e-pv-e-sign-ename">{{data.Name}}</div>
17+
<div class="e-pv-e-sign-ejob">{{data.Mail}}</div>
18+
</div>
19+
</div>
20+
</ng-template>
21+
<ng-template #valueTemplate let-data>
22+
<div style="display: flex;">
23+
<img id="user-img" class="e-pv-e-sign-valueTemp" style="margin: 4px 6px; border-radius: 50%"
24+
[ngStyle]="{'border': '1px solid ' + currentUserBorderColor}"
25+
src="https://ej2.syncfusion.com/angular/demos/assets/pdf-viewer/employees/{{data.Eimg}}.png"
26+
height="30px" width="30px" alt="{{data.Eimg}}" />
27+
<div>
28+
<div class="e-pv-e-sign-name" style="margin-top: 3px;">
29+
{{data.Name}}
30+
</div>
31+
<div class="e-pv-e-sign-job">{{data.Mail}}</div>
32+
</div>
33+
</div>
34+
</ng-template>
35+
</ejs-dropdownlist>
36+
<div style="display: flex;">
37+
<button ejs-button #signatureDiv cssClass="e-outline" (click)="signature($event)" class="e-pv-e-sign-form-field-property">
38+
<i class="e-icons e-signature"></i>
39+
<span style="font-size: 11px; margin-top: 6px;">Signature</span>
40+
</button>
41+
<button ejs-button #initialDiv cssClass="e-outline" (click)="initial($event)" class="e-pv-e-sign-form-field-property">
42+
<i class="e-icons e-font-name"></i>
43+
<span style="font-size: 11px; margin-top: 6px;">Initial</span>
44+
</button>
45+
</div>
46+
<div style="display: flex;">
47+
<button ejs-button #textboxDiv cssClass="e-outline" (click)="textBox($event)" class="e-pv-e-sign-form-field-property">
48+
<i class="e-icons e-text-form"></i>
49+
<span style="font-size: 11px; margin-top: 6px;">Textbox</span>
50+
</button>
51+
<button ejs-button #passwordDiv cssClass="e-outline" (click)="password($event)" class="e-pv-e-sign-form-field-property">
52+
<i class="e-icons e-password"></i>
53+
<span style="font-size: 11px; margin-top: 6px;">Password</span>
54+
</button>
55+
</div>
56+
<div style="display: flex;">
57+
<button ejs-button #checkboxDiv cssClass="e-outline" (click)="checkBox($event)" class="e-pv-e-sign-form-field-property">
58+
<i class="e-icons e-check-box"></i>
59+
<span style="font-size: 11px; margin-top: 6px;">Checkbox</span>
60+
</button>
61+
<button ejs-button #radioButtonDiv cssClass="e-outline" (click)="radioButton($event)" class="e-pv-e-sign-form-field-property">
62+
<i class="e-icons e-radio-button"></i>
63+
<span style="font-size: 11px; margin-top: 6px;">Radio</span>
64+
</button>
65+
</div>
66+
<div style="display: flex;">
67+
<button ejs-button #dropDownDiv cssClass="e-outline" (click)="dropDown($event)" class="e-pv-e-sign-form-field-property">
68+
<i class="e-icons e-drop-down"></i>
69+
<span style="font-size: 11px; margin-top: 6px;">Dropdown</span>
70+
</button>
71+
<button ejs-button #listBoxDiv cssClass="e-outline" (click)="listBox($event)" class="e-pv-e-sign-form-field-property">
72+
<i class="e-icons e-list-unordered"></i>
73+
<span style="font-size: 11px; margin-top: 6px;">Listbox</span>
74+
</button>
75+
</div>
76+
</div>
77+
</ejs-sidebar>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
3+
import { AppComponent } from './app.component';
4+
5+
describe('AppComponent', () => {
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
8+
imports: [
9+
RouterTestingModule
10+
],
11+
declarations: [
12+
AppComponent
13+
],
14+
}).compileComponents();
15+
});
16+
17+
it('should create the app', () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app).toBeTruthy();
21+
});
22+
23+
it(`should have as title 'attachpdf'`, () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
const app = fixture.componentInstance;
26+
expect(app.title).toEqual('attachpdf');
27+
});
28+
29+
it('should render title', () => {
30+
const fixture = TestBed.createComponent(AppComponent);
31+
fixture.detectChanges();
32+
const compiled = fixture.nativeElement as HTMLElement;
33+
expect(compiled.querySelector('.content span')?.textContent).toContain('attachpdf app is running!');
34+
});
35+
});

0 commit comments

Comments
 (0)