To convert a React page with DocRaptor, send HTML or a reachable page URL to the DocRaptor API and enable its JavaScript rendering option so React can run. React components themselves are not API input. Make sure rendering and asynchronous data work have finished, the page’s assets can be reached, and its print styles produce the layout you want.
What DocRaptor needs from a React page
DocRaptor accepts either HTML/XML in document_content or a page address in document_url. Your application must make the finished document available in one of those forms; you cannot send a React component object and expect DocRaptor to render it. DocRaptor’s standard JavaScript engine supports React, but JavaScript is disabled by default. See DocRaptor’s JavaScript documentation and API reference.
As an Amazon Associate I earn from qualifying purchases.
For a public application, the usual flow is to generate the PDF on your server. The server authenticates with DocRaptor, submits the document, and returns the PDF bytes to the browser. This keeps the account API key out of publicly served React code.
Recommended Free Tools
Choose HTML content or a document URL
| Input | Use it when | Check before converting |
|---|---|---|
document_content |
Your server has assembled the HTML for the report or page. | Make sure linked stylesheets, images, fonts, and scripts have resolvable URLs. Set a base URL when relative paths need one. |
document_url |
DocRaptor can retrieve the document from an address accessible to it. | The page must be reachable to DocRaptor, and any access or authentication requirements must be accounted for. |
When supplying content directly, relative references may need absolute URLs, a <base> element, or prince_options.baseurl. A leading slash resolves from the domain root, which may not be the directory you intended. The API reference describes the input and base URL options.
#1 Best Overall
- Convert your PDF files into Word, Excel & Co. the easy way
- Convert scanned documents thanks to our new 2022 OCR technology
- Adjustable conversion settings
- No subscription! Lifetime license!
- Compatible with Windows 11, 10, 8.1, 7 - Internet connection required
Generate the PDF from a server-side route
The request below shows the essential request shape in Node.js. It is an implementation sketch, not a complete authentication sample: configure the authentication method for your server-side DocRaptor request as described in the API reference. The html value must contain the complete document content and styles needed for conversion.
const response = await fetch("https://api.docraptor.com/docs", {
method: "POST",
headers: {
"Content-Type": "application/json",
// Add DocRaptor authentication for this server-side request.
},
body: JSON.stringify({
type: "pdf",
document_content: html,
javascript: true,
test: true
})
});
if (!response.ok) {
throw new Error(`PDF generation failed: ${response.status}`);
}
const pdfBytes = await response.arrayBuffer();
In a real route, send pdfBytes to the browser with a PDF content type and handle the response as binary data. Generation errors may return XML rather than PDF bytes, so do not treat every response body as a valid PDF. The official API overview describes the response modes: synchronous generation returns PDF bytes, hosted document mode returns a public URL, and asynchronous generation returns a status_id for later retrieval.
Rank #2
- Convert over 50 document file formats.
- Preview your files from Doxillion before converting them.
- Use batch conversion to convert thousands of files at once.
- Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
- Burn your converted or original files directly to disc.
The example sets test: true for development. Test-mode PDFs are watermarked. Check the current API reference for test-mode and account terms before relying on them in production.
Enable JavaScript and wait for React to finish
Set the standard API option javascript to true when the page needs React execution. Without it, content created only after JavaScript runs may be absent. DocRaptor’s JavaScript Execution documentation says JavaScript is disabled by default.
Rank #3
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- 1 Year License for 1 Windows & 2 Mobile (Android and/or iOS) devices.
Account for data loaded after the initial page
If React fetches report data or performs other delayed work, the renderer may decide the page is ready before that work completes. Use the documented rendering delay or completion controls for your case, then verify the PDF with realistic data. For the standard engine, DocRaptor documents docraptorJavaScriptFinished() as a function that should report whether JavaScript work has finished. Consult the JavaScript documentation and API reference for the relevant settings.
Choose one JavaScript engine deliberately
DocRaptor generally recommends its standard JavaScript engine for typical React rendering. Its separate Prince JavaScript engine is intended for needs such as Prince-specific PDF scripting or canvas support. Prince is not a modern web browser, and its JavaScript behavior can differ from browser behavior. Avoid enabling both engines casually: the API reference warns that both can execute all JavaScript twice. See JavaScript Execution and the API reference.
Rank #4
- Perfect Adobe Acrobat Pro alternative – lifetime license for Windows 10 and 11.
- EDIT text, images, pages, hyperlinks, designs in PDF documents. ORGANIZE PDFs.
- READ and Comment on PDFs – Intuitive reading modes & document commenting and mark up tools!
- CREATE, COMBINE, SCAN and COMPRESS PDFs.
- FILL forms & Digitally Sign PDFs. Work with Digital certificates
Make assets and print styles PDF-ready
Use reachable stylesheets, fonts, images, and scripts
Every asset needed by the document must be accessible to DocRaptor. With HTML content, use absolute URLs or configure a base URL when relative paths would otherwise resolve incorrectly. With a document URL, check that linked assets are reachable in the same conversion context.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Check print media and page layout
DocRaptor applies print media rules by default. A page designed for screen display may therefore look different in the PDF. Review @media print styles, page size, margins, and page-break behavior. Use screen media only when the document is intentionally styled for that output. The API overview documents media behavior; its print production example demonstrates CSS @page features.
Best Value
- Convert over 50 document file formats.
- Preview your files from Doxillion before converting them.
- Use batch conversion to convert thousands of files at once.
- Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
- Burn your converted or original files directly to disc.
Keep the API key out of public React code
Do not embed a private DocRaptor API key in a client-side bundle. DocRaptor’s tutorial warns that its browser-side JavaScript library exposes the key in page source and recommends server-side use or referrer-based documents for public pages.
A server-side route is the straightforward choice when the application controls PDF generation. DocRaptor also documents a referrer-based route for configured domains; it requires allowed-domain setup and should not be treated as a general replacement for server-side authorization. See referrer-based documents.
Troubleshoot blank or incorrect PDFs
- React content is missing: Confirm that
javascript: trueis set and that you are using the intended engine. - Data is missing or stale: The page may have been converted before asynchronous work finished. Configure the documented delay or completion signal and verify the result with realistic data.
- Images, fonts, or styles are missing: Check that asset URLs are reachable and that relative paths have the correct base URL.
- The layout differs from the browser: Review print-specific CSS, since print media is the default, and inspect page size, margins, and page breaks.
- JavaScript runs twice: Check whether both the standard JavaScript option and Prince’s JavaScript option are enabled.
- The browser exposes your API key: Move the request to a trusted server route, or use the documented referrer-based configuration where appropriate.
- Your code cannot parse the response as a PDF: Check the HTTP status and response body. Generation errors may be XML; asynchronous and hosted modes return different result forms from synchronous PDF generation.
Or skip the browser setup
For a screenshot of a rendered page rather than a DocRaptor PDF, ScreenshotNeo offers a one-request website screenshot API. Use the following cURL example with your API key and target URL; see the ScreenshotNeo documentation for options.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents take screenshots, and the Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month with no card.
Frequently Asked Questions
Can DocRaptor accept a React component directly?
No. It accepts HTML/XML content or a document URL; your application must make the rendered document available in one of those forms.
Does DocRaptor return PDF bytes for every request?
No. Synchronous generation returns PDF bytes; hosted-document and asynchronous modes return a URL and a status ID, respectively.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errors




