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

pdf-page-verification-correction

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

यह स्किल बनाई गई PDF में कितने पेज हैं यह जाँचती है और लक्ष्य से मेल होने तक लेआउट बदलती है। यह उन लोगों के लिए है जिन्हें तय पेज संख्या वाली रिपोर्ट, सारांश या मानचित्र चाहिए।

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

  • ✓जब PDF को सटीक पेज संख्या में फ़िट होना हो, जैसे एक पेज का सारांश।
  • ✓जब इमेज, टेबल या लंबा टेक्स्ट पेज संख्या का अनुमान मुश्किल बनाए।
  • ✓जब पहली PDF बहुत लंबी या बहुत छोटी बने।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-page-verification-correction/SKILL.md

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

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

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

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

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

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

“मेरा सारांश PDF बिल्कुल दो पेज का होना चाहिए। कृपया पेज संख्या जाँचिए और लेआउट तब तक ठीक कीजिए जब तक वह सही न हो।”

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

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

AI PDF बनाता है, PDF लाइब्रेरी से उसके पेज गिनता है, गिनती की तुलना लक्ष्य से करता है, और फ़ॉन्ट साइज़ या मार्जिन जैसी सेटिंग बदलकर फिर से कोशिश करता है।

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

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

PDF Page Count Verification and Correction

This skill provides a systematic approach to ensure PDFs meet target page count requirements through iterative verification and layout adjustment.

When to Use

  • Creating PDFs with strict page limits (e.g., reports, summaries, maps)
  • When initial PDF generation may produce variable page counts
  • When layout elements (images, tables, text) can cause unpredictable overflow

Prerequisites

  • Python with PyPDF2 or fitz (PyMuPDF) installed
  • PDF generation capability (ReportLab, matplotlib, etc.)

Workflow Steps

Step 1: Initial PDF Creation

Generate the PDF with your initial layout parameters:

def create_pdf(output_path, params):
    """Create PDF with given layout parameters"""
    # Your PDF generation logic here
    # params can include: image_size, table_density, font_size, margins
    pass

Step 2: Verify Page Count

Check the generated PDF's page count:

import fitz  # PyMuPDF

def verify_page_count(pdf_path):
    """Return the number of pages in the PDF"""
    doc = fitz.open(pdf_path)
    page_count = len(doc)
    doc.close()
    return page_count

# Alternative with PyPDF2
from PyPDF2 import PdfReader

def verify_page_count_pypdf2(pdf_path):
    reader = PdfReader(pdf_path)
    return len(reader.pages)

Step 3: Compare Against Target

def check_page_requirement(actual, target_max, target_exact=None):
    """
    Check if page count meets requirements
    
    Returns: (meets_requirement, adjustment_needed)
    """
    if target_exact is not None:
        meets = (actual == target_exact)
        direction = "shrink" if actual > target_exact else "expand" if actual < target_exact else None
    else:
        meets = (actual <= target_max)
        direction = "shrink" if actual > target_max else None
    
    return meets, direction

Step 4: Adjust Layout Parameters

If page count exceeds target, adjust one or more parameters:

# Common adjustment strategies
ADJUSTMENT_STRATEGIES = {
    'images': {
        'action': 'reduce_size',
        'param': 'image_scale',
        'step': 0.1,  # Reduce by 10%
        'min': 0.5
    },
    'tables': {
        'action': 'reduce_density',
        'param': 'rows_per_page',
        'step': 2,  # Reduce by 2 rows per page
        'min': 5
    },
    'fonts': {
        'action': 'reduce_size',
        'param': 'font_size',
        'step': 1,  # Reduce by 1pt
        'min': 8
    },
    'margins': {
        'action': 'reduce',
        'param': 'margin_inches',
        'step': 0.1,  # Reduce by 0.1 inches
        'min': 0.3
    }
}

def adjust_params(current_params, direction, strategy='images'):
    """Apply adjustment to parameters"""
    adjusted = current_params.copy()
    strat = ADJUSTMENT_STRATEGIES[strategy]
    
    if direction == 'shrink':
        param = strat['param']
        current_val = adjusted.get(param, 1.0)
        new_val = max(current_val - strat['step'], strat['min'])
        adjusted[param] = new_val
    
    return adjusted

Step 5: Iterative Correction Loop

def create_pdf_with_validation(
    output_path, 
    initial_params, 
    target_max_pages,
    max_iterations=5
):
    """
    Create PDF with iterative page count verification and correction
    
    Args:
        output_path: Where to save the final PDF
        initial_params: Starting layout parameters
        target_max_pages: Maximum allowed pages
        max_iterations: Maximum adjustment attempts
    
    Returns:
        dict with 'success', 'final_page_count', 'iterations', 'final_params'
    """
    params = initial_params.copy()
    
    for iteration in range(max_iterations):
        # Create PDF
        create_pdf(output_path, params)
        
        # Verify
        page_count = verify_page_count(output_path)
        
        # Check requirements
        meets_req, direction = check_page_requirement(
            page_count, target_max_pages
        )
        
        if meets_req:
            print(f"✓ PDF created successfully: {page_count} pages")
            return {
                'success': True,
                'final_page_count': page_count,
                'iterations': iteration + 1,
                'final_params': params
            }
        
        # Adjust and retry
        print(f"Iteration {iteration + 1}: {page_count} pages (need ≤{target_max_pages})")
        params = adjust_params(params, direction)
    
    # Failed to conver
अक्सर पूछे जाने वाले सवाल

लेआउट के कौन से हिस्से बदले जा सकते हैं?

गाइड इमेज का आकार, टेबल का घनत्व, फ़ॉन्ट आकार और मार्जिन सूचीबद्ध करती है।

पेज संख्या कैसे जाँची जाती है?

PyMuPDF या PyPDF2 से, जो बताते हैं कि फ़ाइल में कितने पेज हैं।

क्या प्रक्रिया दोहराई जाती है?

हाँ, शर्त पूरी होने तक जाँच और सुधार दोहराए जाते हैं।

जानकारी

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

Iterative workflow to verify PDF page counts and adjust layout parameters until requirements are met

repo: HKUDS/AgentPilot

लोकप्रियता

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

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

0

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

कमेंट

  • …

इस repository की और skills

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