Skip to main content
Here’s a few examples of how to use markdown2pdf.ai in your code.
You’ll see that, in general, you pass your markdown content, a title and a download path to the convert function and it will handle the markdown conversion for you. A mandatory function must be provided which is used to handle the payment using a mechanism of your choice — either Lightning via L402 or USDC on Solana via X402. This could be a manual payment (copy-and-paste the Lightning invoice into a wallet of your choice, or sign an X402 X-PAYMENT header with a Solana wallet), but more likely will be handled programmatically via a Lightning wallet or a Solana signer.