Per Gareth Wilkin's (gvsyn) pull request on PDF::API2, it certainly appears harmless to allow any garbage after the PDF version number (as a comment), since a number of PDF readers apparently tolerate this (treating it as a comment). If this PDF were to be written back out, we might want to consider turning the extra material into a proper comment. If this was moved to the next line, as an added comment, we would have to be careful not to break any offsets in the cross reference table! In that case, changing the first \s after the version number to a % might work (or, if multiple \s's, a later one). On the other hand, if we're going to regenerate the cross reference table anyway, it would be better to move the new comment to a new line, and be left with an absolutely proper PDF header.
Note: .* by itself should be a "greedy" match, which might eat the $cr sequence. I will replace it by .*? which should be non-greedy.
Regarding the 1 generation number instead of 0, that should certainly give at least a "warning" if no other xref table is found, and the non-0 corrected to 0. Apparently many readers are tolerant of this error, and PDF::Builder should be as forgiving, providing it doesn't cause further errors.
These decisions may not need to wait, but should be revisited once we decide how we're going to read in a PDF file into internal data structures. For the time being, they can be tolerated (fixed up), with possibly a switch to turn off or limit the error message. Coordinate with 106020/#27, which appears to also be a comment on the header line.