I’m building a tenancy agreement generator using react-pdf . Local images stored in my Next.js public/ folder render fine inside , but external images (e.g. from an API or CDN) never show up in the generated PDF.
Here’s a simplified example:
import { Document, Page, Image, Text, View } from "@react-pdf/renderer";
export default function AgreementPDF() {
return (
<Document>
<Page size="A4">
<View>
<Text>External seal image:</Text>
<Image
style={{ width: 100, height: 100 }}
src={{
uri: "https://example.com/uploads/seal.png",
method: "GET",
headers: { "Cache-Control": "no-cache" },
body: "",
}}
/>
</View>
</Page>
</Document>
);
}
What I’ve tried:
Converting the image URL to base64 before passing it → didn’t work.
Setting request headers (e.g. Cache-Control: no-cache) → no effect.
Confirmed the URL works fine if I paste it directly in the browser.
Works only if the image is local (/public/seal.png), not when it’s fetched.
How can I get React-PDF to render external images from an API when generating/downloading a PDF in Next.js? Do I need to proxy the image, or is there a React-PDF limitation here?