Back to library
AI
best practice

Preserve PDF Formatting for Better Context Retention

Keep documents in PDF format to preserve essential visual context.

Avoid converting PDFs to text before uploading, as Gemini captures formatting and imagery that text-only processing misses.

Google Gemini

The Scenario

You need to summarize a brochure or a formatted newsletter where the layout contributes to the meaning of the content.

Before & after

The old way

Converting a PDF to a .txt file to fit word limits takes 5-10 minutes and destroys all tables and image context.

With AI

Upload the original PDF directly; Gemini preserves the context of graphs and formatting in just 1 minute.

The Prompt

Summarize this PDF while maintaining the original structure of the document. Identify any information that is presented purely in visual form (like icons or diagrams) and include it in the summary.

Gemini handles PDFs as a distinct modality. While you can send other documents, they are treated as plain text, which eliminates important visual cues like bold headers, spatial alignment, and graphic data.

Source

Release notes  |  Gemini API  |  Google AI for Developers
"You can also pass non-PDF documents... but Gemini will see them as normal text which will eliminate context like charts or formatting."