| name | PDF Writer |
| description | Use this skill when the user asks to create, generate, export, or write PDF files such as reports, invoices, proposals, one-pagers, handouts, brochures, simple formatted exports, or client-ready PDFs. Triggers on phrases like create PDF, generate PDF, export PDF, write PDF, PDF report, PDF invoice, PDF proposal, one pager, handout, brochure PDF, and make this a PDF. Use it for text-first PDF generation with jsPDF and clear saved output paths. |
PDF Writer
Create PDF documents using the jspdf npm package. Pure Node, no Python, no browser required.
Dependency Check
node -e "const { jsPDF } = require('jspdf'); console.log(typeof jsPDF === 'function' ? 'OK' : 'MISSING')"
Run from D:\Prometheus. If it fails:
node workspace\doc-skills-setup.js --install jspdf
How It Works
- Write a temp script to
D:\Prometheus\workspace\_tmp_pdfwrite.js
- Run it from
D:\Prometheus\workspace
- Save the final file as
workspace\[filename].pdf
- Tell the user the exact file path
- Clean up the temp script
Minimal Example
const { jsPDF } = require('../node_modules/jspdf');
const pdf = new jsPDF({
orientation: 'portrait',
unit: 'pt',
format: 'letter',
});
pdf.setFont('helvetica', 'bold');
pdf.setFontSize(22);
pdf.text('Quarterly Business Summary', 54, 68);
pdf.setFont('helvetica', 'normal');
pdf.setFontSize(11);
pdf.text('Prepared by Prometheus', 54, 92);
const lines = [
'Revenue grew 18% quarter-over-quarter.',
'Customer retention remained above 94%.',
'Pipeline conversion improved after onboarding updates.',
];
let y = 132;
for (const line of lines) {
pdf.text(`- ${line}`, 54, y);
y += 22;
}
pdf.save('quarterly-summary.pdf');
console.log('Created: quarterly-summary.pdf');
Multi-page Pattern
Use pdf.splitTextToSize() when paragraphs are long, and pdf.addPage() when you run out of vertical space.
const { jsPDF } = require('../node_modules/jspdf');
const pdf = new jsPDF({ unit: 'pt', format: 'letter' });
const pageWidth = 612;
const pageHeight = 792;
const margin = 54;
const usableWidth = pageWidth - margin * 2;
let y = margin;
function ensureRoom(requiredHeight = 24) {
if (y + requiredHeight <= pageHeight - margin) return;
pdf.addPage();
y = margin;
}
function writeParagraph(text, size = 11) {
pdf.setFontSize(size);
const lines = pdf.splitTextToSize(text, usableWidth);
ensureRoom(lines.length * 16 + 8);
pdf.text(lines, margin, y);
y += lines.length * 16 + 8;
}
Default Rule
- Use
jspdf for text-first PDFs, summaries, reports, invoices, and simple branded handouts.
- If the user wants a Word document first and a PDF second, generate the PDF directly instead of requiring Office or LibreOffice.
- Save outputs into
D:\Prometheus\workspace\ unless the user asked for a different workspace path.