Captain Blood: His Odyssey (1922) by Rafael Sabatini is just possibly the novel that gave rise to the modern definition of a gentleman pirate.
Peter Blood, an honest man of true character and a humane doctor, is wrongfully imprisoned for treason under the laws of King James, and deported from Britain to a tropical colony at Bridgetown where he is sold as a slave at auction. Soon he encounters romantic inspiration, conflict, injustice, and ultimately finds himself in charge of an armada of pirate ships of various flags and national alliances, becoming the famous and invincible Captain Blood, the most honorable and remarkable buccaneer throughout the South Seas.
This classic romantic pirate tale has been immortalized in a dashing movie starring Errol Flynn.