Start by checking whether the PDF has real text or is a scanned image, since that decides whether you need OCR first. Then define the exact fields you want, such as invoice number, date, vendor, line items and totals, and use the API's structured output or JSON schema feature so the response always matches your format. Check the current docs for how to pass files or images.
Do not trust the output blindly. Add validation in code: line items should sum to the total, dates should parse, and required fields should not be empty. Send failures to a human review queue. Test on a varied sample of 30 to 50 real invoices before going live, because layouts differ more than you expect. Keep the instructions short and put one example in the prompt.