The elementary divisor theorem was originally proved by a calculation on integer matrices, using elementary (invertible) row and column operations to put the matrix into Smith normal form. That is the matrix is zero off the diagonal, and on the diagonal each entry divides the one below it.
This calculation immediately generalizes to matrices over any Euclidean ring.
The key point is that in a Euclidean ring the GCD of two elements can be found by a series of steps where, in each step, one of the arguments is not multiplied by any non-unit. Specifically you reduce an entry $B$ modulo an entry $A$ by adding some (generally non-unit) multiple of A to B to get a result with smaller Euclidean norm than $A$. But $B$ is not multiplied by anything in this step, and so certainly not multiplied by any non-unit.
This does not generalize directly to every PID. In a PID elements $A,B$ have a GCD which is a linear combination of them, But that linear combination may require non-unit multiples of each (even in the integers). And it is not obvious that in every PID the process can be broken into steps where one or the other argument enters the linear combination with no multiplier (or at worst some unit multiplier).
Is there either some way to do it that I have not seen, or a proof that in some PIDs it cannot be done? Can one calculate elementary divisors for PIDs by elementary matrix operations?