/// <summary> /// Opens a new PDF document for writing to appending as a overwrite of the original file if provided, and copying the content of the original file as specified. /// </summary> /// <param name="orig"></param> /// <param name="copytoDestination"></param> public override void OpenDocument(PDFFile orig, bool copytoDestination) { PDFXRefTable prev = null; int startindex = 0; int gen = 0; if (null != orig) { if (copytoDestination) { orig.WriteTo(this.BaseStream); } prev = orig.DocumentXRefs; startindex = prev.MaxReference + 1; gen = prev.Generation; } this.InitXRefTable(startindex, gen, prev); }