with one click
pdf-generation-troubleshooting
Systematic fallback workflow for PDF generation through pandoc, reportlab, and fpdf2 with installation verification
Menu
Systematic fallback workflow for PDF generation through pandoc, reportlab, and fpdf2 with installation verification
| name | pdf-generation-troubleshooting |
| description | Systematic fallback workflow for PDF generation through pandoc, reportlab, and fpdf2 with installation verification |
This skill provides a systematic approach to generating PDFs when multiple tools may be unavailable. Follow this fallback sequence to ensure PDF generation succeeds.
Each step includes installation verification before execution.
Use pandoc for markdown or HTML to PDF conversion. Check availability first:
# Check if pandoc is available
which pandoc || echo "pandoc not found"
If available, convert:
pandoc input.md -o output.pdf
If pandoc fails or is unavailable, proceed to Step 2.
python3 -c "import reportlab" 2>/dev/null && echo "reportlab available" || echo "reportlab not found"
pip install reportlab
Use write_file to create a Python script:
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
def create_pdf(filename, content):
c = canvas.Canvas(filename, pagesize=letter)
c.drawString(100, 750, content)
c.save()
if __name__ == "__main__":
create_pdf("output.pdf", "Your content here")
Use run_shell with proper directory context:
cd /path/to/working/directory && python3 script.py
If reportlab fails, proceed to Step 3.
python3 -c "from fpdf import FPDF" 2>/dev/null && echo "fpdf2 available" || echo "fpdf2 not found"
pip install fpdf2
from fpdf import FPDF
def create_pdf(filename, text):
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size=12)
pdf.cell(200, 10, txt=text, ln=True)
pdf.output(filename)
if __name__ == "__main__":
create_pdf("output.pdf", "Your content here")
cd /path/to/working/directory && python3 script.py
| Tool | Best For | Limitations |
|---|---|---|
| pandoc | Markdown/HTML conversion | Requires external installation |
| reportlab | Complex layouts, graphics | Steeper learning curve |
| fpdf2 | Simple text PDFs | Limited formatting options |
For each tool attempt:
pip install <package>)write_filerun_shell with cd <dir> && <command># Pseudocode for full workflow
if command -v pandoc >/dev/null 2>&1; then
pandoc input.md -o output.pdf && exit 0
fi
if python3 -c "import reportlab" 2>/dev/null; then
# Create and run reportlab script
exit 0
fi
# Final fallback: fpdf2
pip install fpdf2
# Create and run fpdf2 script
cd <dir> && <cmd>)Delegate tasks to OpenSpace — a full-stack autonomous worker for coding, DevOps, web research, and desktop automation, backed by an extensive MCP tool and skill library. Skills auto-improve through use, reducing token consumption over time. A cloud community lets agents share and collectively evolve reusable skills.
Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification
Audio production with diagnostic analysis, timecode parsing from documents, and verified export workflow
Incremental audio production with duration alignment handling, per-stem verification, and adaptive extension strategies
Step-by-step audio production with per-stem verification, timing alignment, and incremental quality gates
End-to-end audio production workflow with stems, effects, archiving, and verification