ILikePdf API & Embed Documentation
Integrate free, private PDF tools directly into your website using iframes, postMessage, or our JavaScript SDK. No watermark, no upload, 100% free.
Quick Start
The simplest way to embed an ILikePdf tool is with an iframe. Add the ?embed=1 parameter to hide the header, sidebar, and footer.
<!-- Embed the Merge PDF tool --> <iframe src="https://www.ilikepdf.tech/merge-pdf?embed=1" width="100%" height="600px" style="border:none;border-radius:8px" allow="clipboard-read; clipboard-write" loading="lazy"></iframe>
Query Parameters
Customize the embedded tool with URL parameters:
| Parameter | Type | Description |
|---|---|---|
embed | 1 | Enables minimal embed mode (hides chrome, removes margins) |
autoRun | true | Auto-process the provided file (must also provide pdfUrl) |
pdfUrl | string | Pre-load a PDF from a URL (must be same-origin or CORS-enabled) |
lang | string | Language code (future use) |
postMessage API
Communicate with the embedded tool using window.postMessage.
Commands (send to iframe)
iframe.contentWindow.postMessage({
command: 'loadPdf',
payload: { url: 'https://example.com/doc.pdf' }
}, 'https://www.ilikepdf.tech');
| Command | Payload | Description |
|---|---|---|
loadPdf | { url: string } | Load a PDF from a URL |
loadPdfBuffer | { buffer: ArrayBuffer } | Load a PDF from an ArrayBuffer (transferable) |
triggerAction | {} | Trigger the primary action (merge, split, compress, etc.) |
download | {} | Trigger download of the result |
reset | {} | Reset the tool to initial state |
Events (listen from iframe)
window.addEventListener('message', (event) => { if (event.origin !== 'https://www.ilikepdf.tech') return; if (event.data.type === 'ready') { console.log('Tool loaded and ready'); } if (event.data.type === 'result') { const { fileName, fileSize, mimeType } = event.data.payload; console.log(`Done: ${fileName} (${fileSize} bytes)`); } if (event.data.type === 'progress') { console.log(`Progress: ${event.data.payload.percent}%`); } if (event.data.type === 'error') { console.error('Error:', event.data.payload.message); } });
| Event Type | Payload | Description |
|---|---|---|
ready | { tool: string } | Fired when the tool finishes loading |
progress | { percent: number, message: string } | Fired during processing |
result | { fileName: string, fileSize: number, mimeType: string } | Fired when processing completes |
error | { message: string } | Fired when an error occurs |
JavaScript SDK
For a more programmatic approach, load the ILikePdf SDK and use the ILikePdf.init() method.
Installation
<!-- Load from CDN --> <script src="https://www.ilikepdf.tech/assets/js/embed.js"></script>
Basic usage
const instance = ILikePdf.init({ target: '#pdf-tool', // CSS selector or DOM element tool: 'merge-pdf', // Tool slug (merge-pdf, split-pdf, compress-pdf, etc.) width: '100%', height: '600px', }); // Or with result handling const inst = ILikePdf.init({ target: '#pdf-tool', tool: 'compress-pdf', onResult: (data) => { console.log(`Compressed: ${data.fileName}`); }, }); // Send commands to the tool inst.postMessage({ command: 'loadPdf', payload: { url: '...' } }); // Remove the tool inst.destroy();
Create a button
const btn = ILikePdf.createButton({ text: 'Compress My PDF', tool: 'compress-pdf', }); document.body.appendChild(btn);
SDK Options
| Option | Type | Default | Description |
|---|---|---|---|
target | string | Element | required | CSS selector or DOM element to mount the iframe |
tool | string | merge-pdf | Tool slug |
width | string | 100% | iframe width |
height | string | 600px | iframe height |
autoRun | boolean | false | Auto-process on load |
pdfUrl | string | - | Pre-load a PDF URL |
onResult | function | - | Callback when tool completes |
onDone | function | - | Alias for onResult |
Available Tools
All 48 tools can be embedded. Use the tool slug as the URL path:
| Tool | Slug (URL path) |
|---|---|
| Merge PDFs | /merge-pdf |
| Compress PDF | /compress-pdf |
| Split PDF | /split-pdf |
| PDF to JPG | /pdf-to-jpg |
| Word to PDF | /word-to-pdf |
| Images to PDF | /images-to-pdf |
| Digital Signature | /digital-signature |
| Fill PDF Forms | /fill-pdf-form |
| ... and 40+ more. See the full list. | |
Example: https://www.ilikepdf.tech/compress-pdf?embed=1
Rate Limits
There are no API rate limits. All processing happens client-side in the user's browser, so usage is limited only by the end user's device capabilities. We do not throttle or charge for any embed usage.
Privacy
When you embed ILikePdf tools, your users' files are processed entirely in their browser. No file data is sent to any server. See our Privacy Policy for details.