File tree Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Original file line number Diff line number Diff line change @@ -978,6 +978,60 @@ export class PdfViewerComponent {
978978</ng2-pdfjs-viewer >
979979```
980980
981+ ## Security Properties
982+
983+ ### ` urlValidation `
984+ - ** Type** : ` boolean `
985+ - ** Default** : ` true `
986+ - ** Description** : Enable URL validation security feature to prevent file parameter manipulation
987+
988+ ``` typescript
989+ // Enable URL validation (default)
990+ urlValidation = true ;
991+
992+ // Disable URL validation
993+ urlValidation = false ;
994+ ```
995+
996+ ``` html
997+ <ng2-pdfjs-viewer
998+ pdfSrc =" document.pdf"
999+ [urlValidation] =" true" >
1000+ </ng2-pdfjs-viewer >
1001+ ```
1002+
1003+ ### ` customSecurityTpl `
1004+ - ** Type** : ` TemplateRef<any> `
1005+ - ** Default** : ` undefined `
1006+ - ** Description** : Custom template for security warnings
1007+
1008+ ``` html
1009+ <ng2-pdfjs-viewer
1010+ pdfSrc =" document.pdf"
1011+ [customSecurityTpl] =" securityTemplate" >
1012+ </ng2-pdfjs-viewer >
1013+
1014+ <ng-template #securityTemplate let-warning =" securityWarning" >
1015+ <div class =" security-warning" *ngIf =" warning" >
1016+ <h4 >⚠️ Security Warning</h4 >
1017+ <p >{{ warning.message }}</p >
1018+ <button (click) =" pdfViewer.dismissSecurityWarning()" >Dismiss</button >
1019+ </div >
1020+ </ng-template >
1021+ ```
1022+
1023+ ### ` securityWarning ` (Read-only)
1024+ - ** Type** : ` SecurityWarning | null `
1025+ - ** Description** : Current security warning data (read-only property)
1026+
1027+ ``` typescript
1028+ interface SecurityWarning {
1029+ message: string ; // Warning message
1030+ originalUrl: string ; // Original file URL
1031+ currentUrl: string ; // Current (modified) file URL
1032+ }
1033+ ```
1034+
9811035## Next Steps
9821036
9831037- 📤 [ ** Component Outputs** ] ( ./component-outputs ) - Event handling
Original file line number Diff line number Diff line change @@ -244,6 +244,32 @@ clearQueue() {
244244}
245245```
246246
247+ ## Security Methods
248+
249+ ### ` setUrlValidation(enabled: boolean) `
250+ - ** Type** : ` Promise<ActionExecutionResult> `
251+ - ** Description** : Enable or disable URL validation security feature
252+ - ** Parameters** :
253+ - ` enabled ` - Whether to enable URL validation (default: true)
254+
255+ ``` typescript
256+ async toggleSecurity () {
257+ await this .pdfViewer .setUrlValidation (false );
258+ console .log (' URL validation disabled' );
259+ }
260+ ```
261+
262+ ### ` dismissSecurityWarning() `
263+ - ** Type** : ` void `
264+ - ** Description** : Dismiss the current security warning
265+
266+ ``` typescript
267+ dismissWarning () {
268+ this .pdfViewer .dismissSecurityWarning ();
269+ console .log (' Security warning dismissed' );
270+ }
271+ ```
272+
247273## Template Methods
248274
249275### ` getErrorTemplateData() `
Original file line number Diff line number Diff line change @@ -498,6 +498,9 @@ export class MyComponent {
498498| ` themeConfig ` | ` ThemeConfig ` | - | Theme configuration |
499499| ` groupVisibility ` | ` GroupVisibilityConfig ` | - | Group visibility configuration |
500500| ` layoutConfig ` | ` LayoutConfig ` | - | Layout configuration |
501+ | ` urlValidation ` | ` boolean ` | ` true ` | Enable URL validation |
502+ | ` customSecurityTpl ` | ` TemplateRef<any> ` | - | Custom security template |
503+ | ` securityWarning ` | ` SecurityWarning \| null ` | - | Security warning data (read-only) |
501504
502505### Output Events
503506
@@ -552,6 +555,8 @@ export class MyComponent {
552555| ` goBack() ` | - | ` void ` | Go back in browser history |
553556| ` closeViewer() ` | - | ` void ` | Close viewer window |
554557| ` getErrorTemplateData() ` | - | ` any ` | Get error template data |
558+ | ` setUrlValidation(enabled: boolean) ` | ` enabled: boolean ` | ` Promise<ActionExecutionResult> ` | Enable/disable URL validation |
559+ | ` dismissSecurityWarning() ` | - | ` void ` | Dismiss security warning |
555560
556561---
557562
You can’t perform that action at this time.
0 commit comments