Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Microsoft Graph’s driveItem content endpoint with format=pdf. Send an authenticated GET request such as /me/drive/items/{item-id}/content?format=pdf, receive a documented 302 Found response, then download the PDF from the temporary URL in the Location header. The redirect URL is preauthenticated, so do not attach your Graph bearer token to the follow-up request.

What the PDF conversion request does

Microsoft Graph treats conversion as a content-download operation. The normal /content route returns the file in its stored format; adding ?format=pdf asks Graph to produce a PDF rendition.

Drive and driveItem resources cover files in OneDrive, OneDrive for Business, and SharePoint document libraries. You can address an item by ID, drive ID, or path, provided the access token can read that location.

Item-ID form

GET https://graph.microsoft.com/v1.0/me/drive/items/{item-id}/content?format=pdf

Drive and path forms

For a known drive, use a route such as:

GET https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/content?format=pdf

Path addressing is also documented. URL-encode path segments when a filename or folder contains spaces, #, ?, or other reserved characters. Resolve the path to a driveItem first if your application needs a stable ID for later jobs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check support before converting

Microsoft explicitly states that not all files can be converted into all formats. The current PDF source-extension table includes common Office files such as DOC, DOCX, PPT, PPTX, XLS, and XLSX, plus formats including HTML, EPUB, ODT, RTF, TIFF, and several email or message formats. Treat that list as authoritative for your tenant and API version; do not promise conversion for an extension that is not listed.

  • Confirm the filename extension and the item’s actual content type.
  • Check the current Microsoft Graph “Convert to other formats” PDF source table before designing a production workflow.
  • Expect a conversion error, rather than a PDF, when the source type is unsupported or the item cannot be read.

Permissions and access context

Use the least-privileged permission that matches how your app runs. Permission approval alone does not grant access to every file: the user, site, drive, item, and (for some SharePoint Embedded scenarios) container still have to be accessible.

Access model Least-privileged permission listed for conversion Important qualification
Delegated, work or school account Files.Read The signed-in user must be able to read the item.
Delegated, personal Microsoft account Files.Read The token and drive must belong to the applicable personal account context.
Application permission Files.ReadWrite.All Use only when an app-only workflow is required; configure tenant consent and access restrictions carefully.
SharePoint Embedded FileStorageContainer.Selected plus applicable container-type permissions These container requirements are additional to the Graph permission model.

The v1.0 reference lists availability in the Global, US Government L4, US Government L5 (DoD), and China operated by 21Vianet national clouds. Verify service availability and consent requirements for your deployment.

Handle the redirect correctly

  1. Send the authenticated Graph request with format=pdf.
  2. Read the response status and Location header. Microsoft documents 302 Found for this operation.
  3. Follow the URL promptly and stream the response body to a file or object store.
  4. Do not send your Graph Authorization header to the follow-up URL. It is preauthenticated.
  5. Check the downloaded bytes and content type before reporting success.

The preauthenticated URL is temporary and normally lasts only a few minutes. Do not queue it for later use; if it expires, repeat the Graph conversion request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Complete examples

cURL: inspect the redirect, then download

curl -sS -D response.headers -o /dev/null 
  -H "Authorization: Bearer $GRAPH_TOKEN" 
  "https://graph.microsoft.com/v1.0/me/drive/items/$ITEM_ID/content?format=pdf"

PDF_URL=$(awk 'BEGIN{IGNORECASE=1} /^Location:/{sub(/^[^:]*:[[:space:]]*/, ""); gsub(/[rn]/, ""); print}' response.headers)
curl -fL "$PDF_URL" -o converted.pdf

Keep the URL on one line when parsing headers. A proxy that rewrites or strips Location can break this flow, so preserve redirects end to end.

Python with requests

import requests

TOKEN = "YOUR_GRAPH_ACCESS_TOKEN"
ITEM_ID = "YOUR_ITEM_ID"
endpoint = f"https://graph.microsoft.com/v1.0/me/drive/items/{ITEM_ID}/content"

r = requests.get(
    endpoint,
    params={"format": "pdf"},
    headers={"Authorization": f"Bearer {TOKEN}"},
    allow_redirects=False,
    timeout=90,
)
r.raise_for_status()
location = r.headers.get("Location")
if not location:
    raise RuntimeError(f"Graph returned {r.status_code} without Location")

pdf = requests.get(location, timeout=90)
pdf.raise_for_status()
with open("converted.pdf", "wb") as f:
    f.write(pdf.content)

Node.js (built-in fetch)

const token = process.env.GRAPH_TOKEN;
const itemId = process.env.ITEM_ID;
const endpoint = new URL(`https://graph.microsoft.com/v1.0/me/drive/items/${itemId}/content`);
endpoint.searchParams.set('format', 'pdf');

const first = await fetch(endpoint, {
  headers: { Authorization: `Bearer ${token}` },
  redirect: 'manual'
});
if (first.status !== 302) throw new Error(`Graph returned ${first.status}`);
const location = first.headers.get('location');
if (!location) throw new Error('Missing Location header');

const second = await fetch(location);
if (!second.ok) throw new Error(`Download failed: ${second.status}`);
const bytes = new Uint8Array(await second.arrayBuffer());
await require('node:fs/promises').writeFile('converted.pdf', bytes);

Saving to object storage

Stream the second response directly to durable storage instead of buffering it in memory. Record the source item ID, conversion timestamp, HTTP statuses, and a checksum of the resulting PDF. Never log the bearer token or the complete preauthenticated URL.

Conversion versus downloading the original

Request Result Use it when
/content The item’s original bytes You need the source file unchanged.
/content?format=pdf A PDF rendition delivered through a temporary redirect URL You need a PDF for viewing, archiving, printing, or downstream processing.

These operations have different permission guidance in the Graph reference. Recheck the permission table for the exact endpoint you deploy rather than assuming the original-download requirements apply to conversion.

Rank #2
4K 16MP Document Camera, Word PDF Conversion, Ultra HD Webcam for Live Streaming, Remote Teaching, Web Conferencing, for OS X Windows OBS Android, Multi Angle Adjustment
  • [High Resolution Imaging] Equipped with a 16MP CMOS sensor capturing ultra high definition 4K UHD images at 3840x3104 resolution and 30 , this document camera delivers real time detail clarity without delays. Its excellent noise reduction and color reproduction perform reliably in dim lighting, while the full auto focus system ensures instant sharpness for documents, textbooks, or live demonstrations across teaching, office, and streaming scenarios.
  • [Flexible Multi Angle Adjustment] Featuring a sturdy support frame with 5 precisely adjustable angle positions, this USB document webcam adapts effortlessly to diverse needs. Rotate smoothly for overhead views during virtual classes, product showcases, or barcode scanning, providing stable positioning for web conferencing, distance learning, and content creation without cumbersome repositioning.
  • [Efficient Document Conversion] Streamline workflows by instantly converting physical documents into digital formats like Word or PDF using compatible software. This teaching document camera simplifies ID card and barcode scanning tasks, eliminating manual data entry while maintaining high speed transmission for professional presentations, lesson planning, and remote collaboration in educational or business environments.
  • [Seamless Plug And Play Setup] Connect directly via USB interface to 7/8/10, OS X, or devices without drivers or complex installation. Third party software like OBS automatically recognizes the camera, enabling immediate use for live streaming, video calls, or recording. The Type C power supply ensures stable operation across temperatures from -25°C to 60°C.
  • [Professional Live Streaming Tool] Elevate broadcast quality by dynamically adjusting camera angles to highlight product details, demonstration steps, or handwritten notes during live sessions. Its compact portable design and consistent 4K output add credibility to teaching content, sales pitches, or remote training, making it ideal for educators, presenters, and content creators seeking reliable visual engagement.

Addressing files safely

Use IDs for repeatable workflows

IDs avoid ambiguity when users rename files or move them within a drive. Resolve a user-, drive-, site-, or path-based lookup to a driveItem, then persist the ID subject to your retention and access rules.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use paths for human-selected files

Paths are convenient for one-off requests, but encode each path segment and account for duplicate names. A path that works in OneDrive may not be valid in a SharePoint document library unless you use that library’s drive.

Troubleshooting

401 Unauthorized

The token is missing, expired, issued for the wrong audience, or lacks the required consent. Acquire a Microsoft Graph token and send it only on the first request.

403 Forbidden

The app has not been granted the needed permission, the user cannot read the item, admin consent is incomplete, or a SharePoint Embedded container requirement is missing. Verify both OAuth configuration and item-level access.

404 Not Found

Check the drive and item ID, user context, site, and path encoding. An item can be visible to one user but not to an app-only identity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

400 or conversion-specific failure

Confirm that the source extension appears in Microsoft’s current PDF conversion table. A corrupt file, an unavailable rendition, or an unsupported format can also fail; retain the Graph error body for diagnosis without exposing secrets.

No Location header

Some HTTP clients automatically follow redirects and hide the first response. Disable automatic redirects, or inspect the final response and client redirect history. Proxies and security gateways must allow the Location header.

Rank #3
TEXT TO PDF CONVERTER - Conversion of any Text to a PDF Document
  • TEXT TO PDF CONVERTER
  • Conversion of any Text to a PDF Document

Expired download URL

Request a fresh conversion URL and download it immediately. Do not persist the temporary URL in a queue or database.

Downloaded file is not a valid PDF

Check the second response status and Content-Type, write the response bytes without text decoding, and reject HTML error pages saved under a .pdf name.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability, performance, and cost considerations

  • No official per-file latency, success-rate, or fidelity benchmark is established here. Measure your own representative files and tenant conditions.
  • Use bounded timeouts, exponential backoff for transient HTTP failures, and an idempotency key in your job record so retries do not create duplicate downstream work.
  • Limit concurrent conversions to protect your service and handle Graph throttling according to the response headers and retry guidance.
  • For large PDFs, stream the redirected response and enforce a maximum size suitable for your storage policy.
  • Cache your own completed PDF only when the source version, permissions, and retention policy permit it; invalidate it when the driveItem changes.

Or skip the browser setup

If your real task is producing screenshots or PDFs of web pages rather than converting a file stored in OneDrive or SharePoint, ScreenshotNeo provides a single HTTP call. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for PDF, viewport, device, CSS, JavaScript, waiting, blocking, authentication, caching, bulk, webhook, and other options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up free.

Frequently Asked Questions

Can Graph convert a PDF back into an editable Word file?

This article covers requesting a PDF rendition. Reverse conversion depends on a separately supported target format and source extension; check the current Graph conversion tables before implementing it.

Should I use delegated or application authentication?

Use delegated access when a signed-in user is performing the operation; use application access for a service workflow that has its own approved tenant-wide access. The least-privileged permission differs, as shown in the table.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I reuse the redirect URL for another user?

No. Treat it as a short-lived, preauthenticated download URL for the immediate request and keep it out of logs and durable storage.

The Bottom Line

For a supported driveItem, call /content?format=pdf, handle Graph’s 302 redirect, and download the temporary URL without the bearer token. Validate file support and permissions before shipping the workflow.