I was tempted to make this question about grounding the dragon in a different way, then the title would have been "How to make an acid-resistant home/prison for a dragon?".
Grounding the dragon is a key element of winning in a fight against them. Ballistas are too cumbersome and crossbows are too weak.
Ours is your typical western dragon and not too large, maybe 2.5 meters at the shoulders and 10 meters in length, half of the body length is the tail. This might seem contrary to what I stated, even if the claim is subjective, but the reason for such a high shoulder height is the placement of the flight muscles.
You see, it's possible to attach more muscle to the keel bone without changing the length of the muscle fibers, by simply connecting them to the bone with tendons (which can be thinner than the bundle of muscle, they're attached to); that's how nature does it.
Of course, the tendons, the bones and wing membranes have to be stronger as well. This is an interesting challenge, but if you're me, you just yell: "Short-fiber composites, using biogenic carbon nanotubes!"
While these muscles would give the dragon a different shape, the creature is highly pneumatized, meaning it's padded with air sacs. Some much so, that there's even a layer of air between the muscle and the scaly hide. And yes, I took inspiration from nature. The purpose of these air layers is to dampen impact and aid respiration at higher altitudes.
Aerial attacks
The dragon's aerial weapons are their breath weapon (though vomit would be a better term). Basically, it's a mixture of sulfuric acid and bleached water, and there's more acid than water. In paper, this substance will boil you alive, and if you survive, the chlorine gas will do you in.
While dragons are dangerous even on the ground, they don't have the advantage of being able to do hasty retreats. Plus, if they fall from high enough, even with the awkward parkour roll, they could still end up seriously injured.
How could a dragon be actually prevented from using their wings for flight? Assume medieval tech level.