A method for processing a digital document containing a digital ink annotation comprised of digital ink strokes, the method comprising: grouping the digital ink strokes created by a user together to define the digital ink annotation; based on the grouped ink strokes, classifying (610; 700) the digital ink annotation to generate an annotation classification; wherein dynamic programming is used to evaluate all possible groupings and classifications of the ink strokes comprising the user annotations; wherein a dynamic processing search space is pruned upfront based on a temporal ordering of strokes, a spatial arrangement of strokes or both; wherein only groups of strokes that are proximate to one another in time and/or space are considered; assigning a first probability based on how likely the strokes in the group are to form the annotation classification, comprising assigning the probability to each of the remaining possible groups of strokes that are evaluated, based on how likely the strokes in the group are to form one of the types of annotations, identifying (610; 710) an anchor context for the group and assigning a second probability that the anchor context is correct, combining the first and second probabilities and placing the combined value in a dynamic programming subproblem solution table; anchoring the digital ink annotation to a region in the digital document with which the digital ink annotation is associated to generate an annotation anchor; wherein, after evaluating all possible groupings that were not pruned upfront, the subproblem solution table is walked through and the set of grouping/classification/anchor context combinations that account for all strokes in the user annotations, do not overlap and maximize the combined grouping probability is chosen and this complete optimal grouping is output as the grouping, classification and anchor context combinations; and reflowing the digital ink annotation in a new layout of the digital document. grouping the digital ink strokes created by a user together to define the digital ink annotation; based on the grouped ink strokes, classifying (610; 700) the digital ink annotation to generate an annotation classification; wherein dynamic programming is used to evaluate all possible groupings and classifications of the ink strokes comprising the user annotations; wherein a dynamic processing search space is pruned upfront based on a temporal ordering of strokes, a spatial arrangement of strokes or both; wherein only groups of strokes that are proximate to one another in time and/or space are considered; assigning a first probability based on how likely the strokes in the group are to form the annotation classification, comprising assigning the probability to each of the remaining possible groups of strokes that are evaluated, based on how likely the strokes in the group are to form one of the types of annotations, identifying (610; 710) an anchor context for the group and assigning a second probability that the anchor context is correct, combining the first and second probabilities and placing the combined value in a dynamic programming subproblem solution table; anchoring the digital ink annotation to a region in the digital document with which the digital ink annotation is associated to generate an annotation anchor; wherein, after evaluating all possible groupings that were not pruned upfront, the subproblem solution table is walked through and the set of grouping/classification/anchor context combinations that account for all strokes in the user annotations, do not overlap and maximize the combined grouping probability is chosen and this complete optimal grouping is output as the grouping, classification and anchor context combinations; and reflowing the digital ink annotation in a new layout of the digital document.