Image generation lives in the same call
Switch to a preview image model and add response_modalities=['IMAGE']. The response's parts contain image bytes you can write to disk.
PDFs go through the File API
Upload PDFs the same way you upload images. Gemini parses text, tables, and (on 2.5+) extracts visual structure. Pages count toward token budget at roughly 250 tokens/page.
The boundary between image gen and image edit
Same model can do both. Send an image part + "replace the sky with stars" → you get a modified image back. Send only text → you get a generated image.