@@ -40,7 +40,7 @@ export class FeaturesComponent implements OnInit {
4040 interactiveErrorTpl ! : TemplateRef < any > ;
4141
4242 // Configuration properties - directly bound to the viewer
43- public pdfSrc = "/assets/pdfjs/web/compressed.tracemonkey-pldi-09.pdf" ;
43+ public pdfSrc : string | Blob | Uint8Array = "/assets/pdfjs/web/compressed.tracemonkey-pldi-09.pdf" ;
4444 public downloadFileName = "sample-document.pdf" ;
4545 public diagnosticLogs = false ;
4646
@@ -515,6 +515,43 @@ export class FeaturesComponent implements OnInit {
515515 }
516516 }
517517
518+ // Test Blob and Uint8Array loading (Issue #283)
519+ public currentSourceType : 'string' | 'blob' | 'uint8array' = 'string' ;
520+
521+ public async loadBlobPdf ( ) {
522+ try {
523+ console . log ( "🧪 Testing Blob pdfSrc loading..." ) ;
524+ const response = await fetch ( '/assets/pdfjs/web/compressed.tracemonkey-pldi-09.pdf' ) ;
525+ const blob = await response . blob ( ) ;
526+ this . pdfSrc = blob ;
527+ this . currentSourceType = 'blob' ;
528+ console . log ( "✅ Blob pdfSrc set successfully:" , blob ) ;
529+ } catch ( error ) {
530+ console . error ( "❌ Blob loading failed:" , error ) ;
531+ }
532+ }
533+
534+ public async loadUint8ArrayPdf ( ) {
535+ try {
536+ console . log ( "🧪 Testing Uint8Array pdfSrc loading..." ) ;
537+ const response = await fetch ( '/assets/pdfjs/web/compressed.tracemonkey-pldi-09.pdf' ) ;
538+ const arrayBuffer = await response . arrayBuffer ( ) ;
539+ const uint8Array = new Uint8Array ( arrayBuffer ) ;
540+ this . pdfSrc = uint8Array ;
541+ this . currentSourceType = 'uint8array' ;
542+ console . log ( "✅ Uint8Array pdfSrc set successfully:" , uint8Array ) ;
543+ } catch ( error ) {
544+ console . error ( "❌ Uint8Array loading failed:" , error ) ;
545+ }
546+ }
547+
548+ public loadStringPdf ( ) {
549+ console . log ( "🧪 Testing string pdfSrc loading..." ) ;
550+ this . pdfSrc = "/assets/pdfjs/web/compressed.tracemonkey-pldi-09.pdf" ;
551+ this . currentSourceType = 'string' ;
552+ console . log ( "✅ String pdfSrc set successfully" ) ;
553+ }
554+
518555 // Convenience setter demonstrations
519556 public useTraditionalApproach = true ;
520557
0 commit comments