add changes from unsaved file

This commit is contained in:
Plaisted 2021-02-08 12:53:02 -06:00
parent 6e1cf89cf9
commit e7f96c0b16

View File

@ -30,7 +30,7 @@ namespace UglyToad.PdfPig.Writer
private readonly Dictionary<Guid, FontStored> fonts = new Dictionary<Guid, FontStored>();
private readonly Dictionary<Guid, ImageStored> images = new Dictionary<Guid, ImageStored>();
private readonly Dictionary<IndirectReferenceToken, IToken> unwrittenTokens = new Dictionary<IndirectReferenceToken, IToken>();
private bool completed = false;
internal int fontId = 0;
/// <summary>
@ -444,7 +444,8 @@ namespace UglyToad.PdfPig.Writer
}
return dict;
}
}
}
private void CompleteDocument()
{
// write fonts to reserved object numbers
@ -584,6 +585,8 @@ namespace UglyToad.PdfPig.Writer
context.CompletePdf(catalogRef, informationReference);
completed = true;
(int Count, IndirectReferenceToken Ref) CreatePageTree(List<Dictionary<NameToken, IToken>> pagesNodes, IndirectReferenceToken parent)
{
// TODO shorten page tree when there is a single or small number of pages left in a branch
@ -807,6 +810,11 @@ namespace UglyToad.PdfPig.Writer
/// </summary>
public void Dispose()
{
if (!completed)
{
CompleteDocument();
}
context.Dispose();
}
}