Skip to content

Commit f918fe3

Browse files
codehippie1actions-user
authored andcommitted
Sync root README with lib/README
1 parent f841878 commit f918fe3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,55 @@ export class MyComponent {
425425
- **Unique `target` name** → Always opens new tab
426426
- **`target="_blank"`** → Browser decides (usually reuses)
427427

428+
### iframe Security
429+
430+
```html
431+
<!-- Built-in security (always enabled) -->
432+
<ng2-pdfjs-viewer
433+
pdfSrc="document.pdf">
434+
</ng2-pdfjs-viewer>
435+
```
436+
437+
**Built-in Security Features:**
438+
- **Static Sandbox** - `allow-forms allow-scripts allow-same-origin allow-modals`
439+
- **XSS Prevention** - Prevents malicious scripts from affecting parent page
440+
- **CSP Compliance** - Meets Content Security Policy requirements
441+
- **Data Protection** - Limits iframe access to parent window context
442+
- **Enterprise Ready** - Suitable for corporate security environments
443+
444+
**Sandbox Attributes (Fixed for Security):**
445+
- `allow-forms` - Required for PDF form functionality
446+
- `allow-scripts` - Required for PDF.js JavaScript execution
447+
- `allow-same-origin` - Required for loading PDF files and assets
448+
- `allow-modals` - Required for PDF.js dialogs (print, download)
449+
450+
### iframe Styling
451+
452+
```html
453+
<!-- Default (no border) -->
454+
<ng2-pdfjs-viewer
455+
pdfSrc="document.pdf">
456+
</ng2-pdfjs-viewer>
457+
458+
<!-- Custom border -->
459+
<ng2-pdfjs-viewer
460+
pdfSrc="document.pdf"
461+
iframeBorder="2px solid #ccc">
462+
</ng2-pdfjs-viewer>
463+
464+
<!-- Numeric border -->
465+
<ng2-pdfjs-viewer
466+
pdfSrc="document.pdf"
467+
[iframeBorder]="1">
468+
</ng2-pdfjs-viewer>
469+
470+
<!-- No border (explicit) -->
471+
<ng2-pdfjs-viewer
472+
pdfSrc="document.pdf"
473+
iframeBorder="0">
474+
</ng2-pdfjs-viewer>
475+
```
476+
428477
---
429478

430479
## 📚 API Reference
@@ -501,6 +550,7 @@ export class MyComponent {
501550
| `urlValidation` | `boolean` | `true` | Enable URL validation |
502551
| `customSecurityTpl` | `TemplateRef<any>` | - | Custom security template |
503552
| `securityWarning` | `SecurityWarning \| null` | - | Security warning data (read-only) |
553+
| `iframeBorder` | `string \| number` | `"0"` | iframe border style |
504554

505555
### Output Events
506556

0 commit comments

Comments
 (0)