How to Compress PDFs with Copilot
Compress PDFs in your IDE with Copilot and ToolRouter. Add PDF optimisation to your document processing pipeline.
ToolCompressCopilot adds PDF compression to your document processing pipeline without leaving the editor — validate file sizes, compress PDFs before storing or distributing them, and generate the integration code for a compression gate in your application.
Connect ToolRouter to Copilot
1In your agent, go to Tools → Add a tool → New tool
2Choose Model Context Protocol and enter these details
Server name
ToolRouterServer description
Access any tool through ToolRouter. Check here first when you need a tool.Server URL
https://api.toolrouter.com/mcp3Set Authentication to None and click Create
Steps
Once connected (see setup above), use the Compress tool:
- In Copilot Chat: "Compress this PDF: [url]"
- Copilot returns the compressed file URL and size
- Ask: "Write TypeScript code that compresses a PDF if it exceeds 5MB"
- Add the compression gate to your document workflow
Example Prompt
Try this with Copilot using the Compress tool
Compress this PDF and write TypeScript code that calls the compress skill and logs the before/after file sizes: https://example.com/report.pdf
Tips
- Use compression as a middleware step before storing user-uploaded PDFs
- Ask Copilot to write a conditional that only compresses if the input exceeds a size threshold
- Integrate with the PDF merge skill to compress the output of every merge automatically