Categories

PDF Code Snippet Viewer

Render code snippets with mono font, background boxes, and clickable Git repository links

Create a developer-friendly PDF for code review and sharing. **Features:** - Monospace code blocks with background cards - File and line metadata header per snippet - Clickable `View on Git` links to repository source

Example Results

2 examples

Light Theme Multi-Snippet View

Renders two TypeScript snippets with clickable GitHub links

code-snippet-viewer-example1.pdf View File
View input parameters
{ "snippetsJson": "[{\"filePath\":\"src/index.ts\",\"language\":\"ts\",\"startLine\":1,\"endLine\":8,\"code\":\"import { Elysia } from 'elysia'\\n\\nconst app = new Elysia()\\n\\napp.get('/', () => 'ok')\\n\\nexport default app\"},{\"filePath\":\"src/tools/2026-02-13/pdf-link-annotator.ts\",\"language\":\"ts\",\"startLine\":30,\"endLine\":52,\"code\":\"function addExternalLink(pdf, page, x, y, w, h, url) {\\n const annot = pdf.context.obj({\\n Type: 'Annot',\\n Subtype: 'Link',\\n })\\n // ...\\n}\"}]", "repoBaseUrl": "https://github.com/example/repo", "branch": "main", "pageSize": "A4", "landscape": false, "theme": "light" }

Dark Theme Landscape Review

Single snippet in dark theme using Letter landscape layout

code-snippet-viewer-example2.pdf View File
View input parameters
{ "snippetsJson": "[{\"filePath\":\"src/tool-manager.ts\",\"language\":\"ts\",\"startLine\":55,\"endLine\":92,\"code\":\"export class ToolManager {\\n private tools = new Map()\\n\\n registerTool(tool) {\\n this.tools.set(tool.id, tool)\\n }\\n\\n getTool(id) {\\n return this.tools.get(id)\\n }\\n}\"}]", "repoBaseUrl": "https://gitlab.com/example/platform", "branch": "develop", "pageSize": "Letter", "landscape": true, "theme": "dark" }

API Documentation

Request Endpoint

POST /en/api/tools/pdf-code-snippet-viewer

Request Parameters

Parameter Name Type Required Description
snippetsJson textarea Yes -
repoBaseUrl text No -
branch text No -
pageSize select No -
landscape checkbox No -
theme select No -

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-pdf-code-snippet-viewer": {
      "name": "pdf-code-snippet-viewer",
      "description": "Render code snippets with mono font, background boxes, and clickable Git repository links",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=pdf-code-snippet-viewer",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]