मुख्य सामग्री पर जाएँ
Skillpedia
PDF, Word और स्लाइड7.8k · #12856

document-gen-resilient-workflow

यह क्या करती है

यह स्किल AI को Word, PDF या HTML जैसे दस्तावेज़ बनाने का मार्गदर्शन देती है, जिसमें टूल टूटने पर बैकअप विकल्प होते हैं। यह उन लोगों के लिए है जिन्हें भरोसेमंद दस्तावेज़ चाहिए, खासकर विशेष अक्षरों वाले।

कब इस्तेमाल करें

  • ✓जब LaTeX की कमी या एन्कोडिंग एरर की वजह से PDF नहीं बन पा रही हो।
  • ✓जब एक ही स्रोत से दस्तावेज़ कई फ़ॉर्मैट में चाहिए हों।
  • ✓जब टेक्स्ट में ऐसे चिह्न या गैर-अंग्रेज़ी अक्षर हों जो रूपांतरण को बिगाड़ते हों।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-2794b4/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/document-gen-fallback-enhanced-enhanced-2794b4/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे नोट्स को Word फ़ाइल और PDF में बदलना है, और लिखे हुए अक्षर सही दिखने चाहिए। कृपया मदद कीजिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

AI सामग्री Markdown में लिखता है, ज़रूरत हो तो विशेष चिह्न ठीक करता है, PDF इंजन एक-एक करके आज़माता है जब तक कोई काम न करे, और जाँचता है कि आउटपुट फ़ाइल सही है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Resilient Document Generation Workflow (Multi-Engine Fallback)

When to Use

Use this skill when document generation tasks fail or when shell_agent returns unknown errors, especially for:

  • Generating documents in multiple formats (.docx, .pdf, .html)
  • PDF generation fails due to missing LaTeX, encoding issues, or tool errors
  • Documents contain special characters, symbols, or non-ASCII text
  • You need maximum reliability with automatic fallback options

Core Technique

Split document generation into discrete, observable steps with cascading fallbacks for PDF generation:

  1. Content creation → Use write_file to create source Markdown
  2. Unicode sanitization → Use Python script for reliable character replacement
  3. Format conversion → Try multiple PDF engines in sequence until one succeeds
  4. Verification → Check file exists, has non-zero size, and is valid

⚠️ Unicode & PDF Engine Guide

Different PDF engines have different Unicode support:

Engine Unicode Support Best For Fallback Position
pdflatex Limited (ASCII-focused) Simple documents 1st (fastest)
xelatex Full Unicode Documents with non-ASCII 2nd
wkhtmltopdf Good Unicode Web-style documents 3rd
reportlab (Python) Full control Programmatic PDFs 4th
fpdf2 (Python) Full control Simple text PDFs 5th (last resort)

Character Replacement Table

Character Issue Safe Replacement
— (em dash) LaTeX incompatibility --
– (en dash) LaTeX incompatibility -
" " (curly quotes) Encoding errors " " (straight)
' ' (curly apostrophe) Encoding errors ' (straight)
… (ellipsis) May not render ...
→ ← ↑ ↓ LaTeX incompatibility -> <- ^ v
✓ ✗ May not render [x] [ ]
★ ● May not render * -
© ® ™ May require packages (c) (r) (tm)
é ñ ü Font-dependent Keep for xelatex, replace for pdflatex

Step-by-Step Workflow

Step 1: Create Source Content with write_file

Write your document content as Markdown to a source file:

write_file
path: /tmp/document_source.md
content: |
  # Document Title
  
  ## Section 1
  Content here...
  
  ## Section 2
  More content...

Step 2: Sanitize Unicode with Python Script

Create a reusable Python sanitizer for reliable character replacement:

write_file
path: /tmp/sanitize_unicode.py
content: |
  #!/usr/bin/env python3
  import sys
  import re
  
  if len(sys.argv) < 2:
      print("Usage: sanitize_unicode.py <input.md> [output.md]")
      sys.exit(1)
  
  input_file = sys.argv[1]
  output_file = sys.argv[2] if len(sys.argv) > 2 else input_file.replace('.md', '_sanitized.md')
  
  replacements = {
      '—': '--',    # em dash
      '–': '-',     # en dash
      '"': '"',     # left curly quote
      '"': '"',     # right curly quote
      "'": "'",     # left curly apostrophe
      "'": "'",     # right curly apostrophe
      '…': '...',   # ellipsis
      '→': '->',    # right arrow
      '←': '<-',    # left arrow
      '↑': '^',     # up arrow
      '↓': 'v',     # down arrow
      '✓': '[x]',   # checkmark
      '✗': '[ ]',   # cross
      '★': '*',     # star
      '●': '-',     # bullet
      '©': '(c)',   # copyright
      '®': '(r)',   # registered
      '™': '(tm)',  # trademark
  }
  
  with open(input_file, 'r', encoding='utf-8') as f:
      content = f.read()
  
  for old, new in replacements.items():
      content = content.replace(old, new)
  
  with open(output_file, 'w', encoding='utf-8') as f:
      f.write(content)
  
  print(f"Sanitized: {input_file} -> {output_file}")

Apply sanitization for PDF:

run_shell
command: python3 /tmp/sanitize_unicode.py /tmp/document_source.md /tmp/document_source_sanitized.md

Note: Keep original for DOCX/HTML (these formats handle Unicode well).

Step 3: Convert to Target Formats with Cascading Fallbacks

For DOCX (from original, no sanitization needed):

run_shell
command: pandoc /tmp/document_source.md -o output.docx

For PDF (try multiple engines in sequence):

Attempt 1: pdflatex (fastest, limited Unicode)

run_shell
command: pandoc /tmp/document_source_sanitized.md -o output.pdf --pdf-engine=pdflatex

*If pdflatex fails, Attempt 2: xelatex (full Unicode)

अक्सर पूछे जाने वाले सवाल

कौन से PDF इंजन आज़माए जाते हैं?

गाइड pdflatex, xelatex, wkhtmltopdf, reportlab और fpdf2 को तय क्रम में विकल्प के रूप में बताती है।

Unicode का समर्थन क्यों मायने रखता है?

कुछ PDF इंजन गैर-ASCII अक्षरों को ठीक से नहीं संभालते, इसलिए गाइड बताती है कि कौन सा इंजन चुनें।

क्या नतीजे की जाँच होती है?

हाँ, गाइड कहती है कि फ़ाइल मौजूद है, उसमें सामग्री है और वह सही है, यह पक्का करें।

जानकारी

लेखक का मूल विवरण

Multi-engine document generation with cascading PDF fallbacks and robust Unicode handling

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#12856
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills