@@ -216,12 +216,15 @@ impl C2paPdf for Pdf {
216216 return Ok ( None ) ;
217217 } ;
218218
219+ let ef = & self
220+ . document
221+ . get_object ( id)
222+ . and_then ( Object :: as_dict) ?
223+ . get_deref ( b"EF" , & self . document ) ?
224+ . as_dict ( ) ?; // EF dictionary
225+
219226 Ok ( Some ( vec ! [
220- & self
221- . document
222- . get_object( id)
223- . and_then( Object :: as_dict) ?
224- . get_deref( b"EF" , & self . document) ?
227+ & ef. get_deref( b"F" , & self . document) ? // F embedded file stream
225228 . as_stream( ) ?
226229 . content,
227230 ] ) )
@@ -238,12 +241,13 @@ impl C2paPdf for Pdf {
238241 . ok_or_else ( || Error :: NoManifest ) ?;
239242
240243 // Find the manifest's file stream.
241- let file_stream_ref = self
244+ let file_stream_ef_ref = self
242245 . document
243246 . get_object ( file_spec_ref) ?
244247 . as_dict ( ) ?
245- . get ( b"EF" ) ?
246- . as_reference ( ) ?;
248+ . get ( b"EF" ) ?;
249+
250+ let file_stream_ref = file_stream_ef_ref. as_dict ( ) ?. get ( b"F" ) ?. as_reference ( ) ?;
247251
248252 // Attempt to remove the manifest from the PDF's `Embedded Files`s. If the manifest
249253 // isn't in the PDF's embedded files, remove the manifest from the PDF's annotations.
@@ -436,7 +440,9 @@ impl Pdf {
436440 AF_RELATIONSHIP_KEY => Name ( C2PA_RELATIONSHIP . into( ) ) ,
437441 "Desc" => Object :: string_literal( CONTENT_CREDS ) ,
438442 "F" => Object :: string_literal( CONTENT_CREDS ) ,
439- "EF" => Reference ( file_stream_ref) ,
443+ "EF" => dictionary! {
444+ "F" => Reference ( file_stream_ref) ,
445+ } ,
440446 TYPE_KEY => Name ( "FileSpec" . into( ) ) ,
441447 "UF" => Object :: string_literal( CONTENT_CREDS ) ,
442448 } ;
@@ -449,8 +455,10 @@ impl Pdf {
449455 fn add_c2pa_embedded_file_stream ( & mut self , bytes : Vec < u8 > ) -> ObjectId {
450456 let stream = Stream :: new (
451457 dictionary ! {
458+ "F" => dictionary! {
452459 SUBTYPE_KEY => C2PA_MIME_TYPE ,
453460 "Length" => Integer ( bytes. len( ) as i64 ) ,
461+ } ,
454462 } ,
455463 bytes,
456464 ) ;
0 commit comments