When Shakespeare wrote Henry IV, Part II and the sources he used as the basis for the play.
Henry IV Part II was first printed in a Quarto edition in 1600 and had been performed several times before that date. It is likely it was written very soon after Shakespeare completed Part I and almost certainly was written before Henry V (1599). The play was not reprinted until its inclusion in revised form in the First Folio in 1623, with some extra 200 lines of text that are not present in the Quarto.
Part II draws on the same sources as Shakespeare used for Part I, largely Holinshed's Chronicles. Historical events are rearranged and compressed and the rebellions which take place during the play are condensed from a number of uprisings. The play also includes a greater proportion of invented material – the Gloucester scenes, for example, are Shakespeare's own invention.