Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// PDFsharp - A .NET library for processing PDF
// PDFsharp - A .NET library for processing PDF
// See the LICENSE file in the solution root for more information.

namespace PdfSharp.Pdf.Advanced
Expand Down Expand Up @@ -28,7 +28,8 @@ void Initialize()

var embeddedFileDictionary = new PdfDictionary(Owner);

Owner.Internals.AddObject(_embeddedFileStream);
if(_embeddedFileStream.Reference is null) // 2 or more PdfFileSpecification could reference the same PdfEmbeddedFileStream, so it may not be necessary to add it again to Internals
Owner.Internals.AddObject(_embeddedFileStream);
embeddedFileDictionary.Elements.SetReference(Keys.F, _embeddedFileStream.Reference ?? throw TH.InvalidOperationException_ReferenceMustNotBeNull());
embeddedFileDictionary.Elements.SetReference(Keys.UF, _embeddedFileStream.Reference);

Expand Down