mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-15 23:24:37 +08:00
add changes from unsaved file
This commit is contained in:
parent
6e1cf89cf9
commit
e7f96c0b16
@ -30,7 +30,7 @@ namespace UglyToad.PdfPig.Writer
|
|||||||
private readonly Dictionary<Guid, FontStored> fonts = new Dictionary<Guid, FontStored>();
|
private readonly Dictionary<Guid, FontStored> fonts = new Dictionary<Guid, FontStored>();
|
||||||
private readonly Dictionary<Guid, ImageStored> images = new Dictionary<Guid, ImageStored>();
|
private readonly Dictionary<Guid, ImageStored> images = new Dictionary<Guid, ImageStored>();
|
||||||
private readonly Dictionary<IndirectReferenceToken, IToken> unwrittenTokens = new Dictionary<IndirectReferenceToken, IToken>();
|
private readonly Dictionary<IndirectReferenceToken, IToken> unwrittenTokens = new Dictionary<IndirectReferenceToken, IToken>();
|
||||||
|
private bool completed = false;
|
||||||
internal int fontId = 0;
|
internal int fontId = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -444,7 +444,8 @@ namespace UglyToad.PdfPig.Writer
|
|||||||
}
|
}
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CompleteDocument()
|
private void CompleteDocument()
|
||||||
{
|
{
|
||||||
// write fonts to reserved object numbers
|
// write fonts to reserved object numbers
|
||||||
@ -584,6 +585,8 @@ namespace UglyToad.PdfPig.Writer
|
|||||||
|
|
||||||
context.CompletePdf(catalogRef, informationReference);
|
context.CompletePdf(catalogRef, informationReference);
|
||||||
|
|
||||||
|
completed = true;
|
||||||
|
|
||||||
(int Count, IndirectReferenceToken Ref) CreatePageTree(List<Dictionary<NameToken, IToken>> pagesNodes, IndirectReferenceToken parent)
|
(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
|
// 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>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
if (!completed)
|
||||||
|
{
|
||||||
|
CompleteDocument();
|
||||||
|
}
|
||||||
|
|
||||||
context.Dispose();
|
context.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user