[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6KJCF539HWJR34F5R6YEAM9":3,"skill-same:01M6KJCF539HWJR34F5R6YEAM9":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":13,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":6,"ownerDescription":42,"updatedAt":43,"install":44,"resources":57},"01M6KJCF539HWJR34F5R6YEAM9","pdf-page-verification-correction",null,"Iterative workflow to verify PDF page counts and adjust layout parameters until requirements are met","AG064\u002FOpenSpace","AG064","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184930299?v=4","01M6KHVFG7TB73NHX3RDYSTMH2","01M6KHVFMM7XA2PZA9Z83PHS3V",0,"MIT","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-page-verification-correction\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31],"PDF","verification","page","pdf page verification correction","workflow","verify","requirements","layout","adjust","2026-11-10 10:12:30",false,"---\nname: pdf-page-verification-correction\ndescription: Iterative workflow to verify PDF page counts and adjust layout parameters until requirements are met\n---\n\n# PDF Page Count Verification and Correction\n\nThis skill provides a systematic approach to ensure PDFs meet target page count requirements through iterative verification and layout adjustment.\n\n## When to Use\n\n- Creating PDFs with strict page limits (e.g., reports, summaries, maps)\n- When initial PDF generation may produce variable page counts\n- When layout elements (images, tables, text) can cause unpredictable overflow\n\n## Prerequisites\n\n- Python with PyPDF2 or fitz (PyMuPDF) installed\n- PDF generation capability (ReportLab, matplotlib, etc.)\n\n## Workflow Steps\n\n### Step 1: Initial PDF Creation\n\nGenerate the PDF with your initial layout parameters:\n\n```python\ndef create_pdf(output_path, params):\n    \"\"\"Create PDF with given layout parameters\"\"\"\n    # Your PDF generation logic here\n    # params can include: image_size, table_density, font_size, margins\n    pass\n```\n\n### Step 2: Verify Page Count\n\nCheck the generated PDF's page count:\n\n```python\nimport fitz  # PyMuPDF\n\ndef verify_page_count(pdf_path):\n    \"\"\"Return the number of pages in the PDF\"\"\"\n    doc = fitz.open(pdf_path)\n    page_count = len(doc)\n    doc.close()\n    return page_count\n\n# Alternative with PyPDF2\nfrom PyPDF2 import PdfReader\n\ndef verify_page_count_pypdf2(pdf_path):\n    reader = PdfReader(pdf_path)\n    return len(reader.pages)\n```\n\n### Step 3: Compare Against Target\n\n```python\ndef check_page_requirement(actual, target_max, target_exact=None):\n    \"\"\"\n    Check if page count meets requirements\n    \n    Returns: (meets_requirement, adjustment_needed)\n    \"\"\"\n    if target_exact is not None:\n        meets = (actual == target_exact)\n        direction = \"shrink\" if actual > target_exact else \"expand\" if actual \u003C target_exact else None\n    else:\n        meets = (actual \u003C= target_max)\n        direction = \"shrink\" if actual > target_max else None\n    \n    return meets, direction\n```\n\n### Step 4: Adjust Layout Parameters\n\nIf page count exceeds target, adjust one or more parameters:\n\n```python\n# Common adjustment strategies\nADJUSTMENT_STRATEGIES = {\n    'images': {\n        'action': 'reduce_size',\n        'param': 'image_scale',\n        'step': 0.1,  # Reduce by 10%\n        'min': 0.5\n    },\n    'tables': {\n        'action': 'reduce_density',\n        'param': 'rows_per_page',\n        'step': 2,  # Reduce by 2 rows per page\n        'min': 5\n    },\n    'fonts': {\n        'action': 'reduce_size',\n        'param': 'font_size',\n        'step': 1,  # Reduce by 1pt\n        'min': 8\n    },\n    'margins': {\n        'action': 'reduce',\n        'param': 'margin_inches',\n        'step': 0.1,  # Reduce by 0.1 inches\n        'min': 0.3\n    }\n}\n\ndef adjust_params(current_params, direction, strategy='images'):\n    \"\"\"Apply adjustment to parameters\"\"\"\n    adjusted = current_params.copy()\n    strat = ADJUSTMENT_STRATEGIES[strategy]\n    \n    if direction == 'shrink':\n        param = strat['param']\n        current_val = adjusted.get(param, 1.0)\n        new_val = max(current_val - strat['step'], strat['min'])\n        adjusted[param] = new_val\n    \n    return adjusted\n```\n\n### Step 5: Iterative Correction Loop\n\n```python\ndef create_pdf_with_validation(\n    output_path, \n    initial_params, \n    target_max_pages,\n    max_iterations=5\n):\n    \"\"\"\n    Create PDF with iterative page count verification and correction\n    \n    Args:\n        output_path: Where to save the final PDF\n        initial_params: Starting layout parameters\n        target_max_pages: Maximum allowed pages\n        max_iterations: Maximum adjustment attempts\n    \n    Returns:\n        dict with 'success', 'final_page_count', 'iterations', 'final_params'\n    \"\"\"\n    params = initial_params.copy()\n    \n    for iteration in range(max_iterations):\n        # Create PDF\n        create_pdf(output_path, params)\n        \n        # Verify\n        page_count = verify_page_count(output_path)\n        \n        # Check requirements\n        meets_req, direction = check_page_requirement(\n            page_count, target_max_pages\n        )\n        \n        if meets_req:\n            print(f\"✓ PDF created successfully: {page_count} pages\")\n            return {\n                'success': True,\n                'final_page_count': page_count,\n                'iterations': iteration + 1,\n                'final_params': params\n            }\n        \n        # Adjust and retry\n        print(f\"Iteration {iteration + 1}: {page_count} pages (need ≤{target_max_pages})\")\n        params = adjust_params(params, direction)\n    \n    # Failed to converge\n    return {\n        'success': False,\n        'final_page_count': page_count,\n        'iterations': max_iterations,\n        'final_params': params,\n        'error': f\"Failed to meet page requirement after {max_iterations} iterations\"\n    }\n```\n\n## Example Usage\n\n```python\n# Initial parameters\nparams = {\n    'image_scale': 1.0,\n    'font_size': 10,\n    'margin_inches': 0.5,\n    'rows_per_page': 15\n}\n\n# Create map PDF limited to 1 page\nresult = create_pdf_with_validation(\n    output_path='property_map.pdf',\n    initial_params=params,\n    target_max_pages=1,\n    max_iterations=5\n)\n\nif not result['success']:\n    # Consider more aggressive adjustments or content reduction\n    print(f\"Warning: {result['error']}\")\n```\n\n## Tips\n\n1. **Prioritize adjustments**: Start with less intrusive changes (margins, image scale) before more significant ones (font size, content removal)\n\n2. **Track iteration history**: Log each iteration's parameters and page count to identify which adjustments are most effective\n\n3. **Set reasonable limits**: Don't reduce parameters below readable\u002Fviewable thresholds\n\n4. **Consider content-based solutions**: If layout adjustments fail, consider removing or summarizing content\n\n5. **Use multiple strategies sequentially**: Try image reduction first, then table density, then fonts\n\n## Common Adjustment Order\n\n1. Reduce margins (least visible impact)\n2. Reduce image sizes\n3. Reduce table density \u002F increase pagination\n4. Reduce font sizes\n5. Remove or summarize content (last resort)","# PDF Page Count Verification and Correction\n\nThis skill provides a systematic approach to ensure PDFs meet target page count requirements through iterative verification and layout adjustment.\n\n## When to Use\n\n- Creating PDFs with strict page limits (e.g., reports, summaries, maps)\n- When initial PDF generation may produce variable page counts\n- When layout elements (images, tables, text) can cause unpredictable overflow\n\n## Prerequisites\n\n- Python with PyPDF2 or fitz (PyMuPDF) installed\n- PDF generation capability (ReportLab, matplotlib, etc.)\n\n## Workflow Steps\n\n### Step 1: Initial PDF Creation\n\nGenerate the PDF with your initial layout parameters:\n\n```python\ndef create_pdf(output_path, params):\n    \"\"\"Create PDF with given layout parameters\"\"\"\n    # Your PDF generation logic here\n    # params can include: image_size, table_density, font_size, margins\n    pass\n```\n\n### Step 2: Verify Page Count\n\nCheck the generated PDF's page count:\n\n```python\nimport fitz  # PyMuPDF\n\ndef verify_page_count(pdf_path):\n    \"\"\"Return the number of pages in the PDF\"\"\"\n    doc = fitz.open(pdf_path)\n    page_count = len(doc)\n    doc.close()\n    return page_count\n\n# Alternative with PyPDF2\nfrom PyPDF2 import PdfReader\n\ndef verify_page_count_pypdf2(pdf_path):\n    reader = PdfReader(pdf_path)\n    return len(reader.pages)\n```\n\n### Step 3: Compare Against Target\n\n```python\ndef check_page_requirement(actual, target_max, target_exact=None):\n    \"\"\"\n    Check if page count meets requirements\n    \n    Returns: (meets_requirement, adjustment_needed)\n    \"\"\"\n    if target_exact is not None:\n        meets = (actual == target_exact)\n        direction = \"shrink\" if actual > target_exact else \"expand\" if actual \u003C target_exact else None\n    else:\n        meets = (actual \u003C= target_max)\n        direction = \"shrink\" if actual > target_max else None\n    \n    return meets, direction\n```\n\n### Step 4: Adjust Layout Parameters\n\nIf page count exceeds target, adjust one or more parameters:\n\n```python\n# Common adjustment strategies\nADJUSTMENT_STRATEGIES = {\n    'images': {\n        'action': 'reduce_size',\n        'param': 'image_scale',\n        'step': 0.1,  # Reduce by 10%\n        'min': 0.5\n    },\n    'tables': {\n        'action': 'reduce_density',\n        'param': 'rows_per_page',\n        'step': 2,  # Reduce by 2 rows per page\n        'min': 5\n    },\n    'fonts': {\n        'action': 'reduce_size',\n        'param': 'font_size',\n        'step': 1,  # Reduce by 1pt\n        'min': 8\n    },\n    'margins': {\n        'action': 'reduce',\n        'param': 'margin_inches',\n        'step': 0.1,  # Reduce by 0.1 inches\n        'min': 0.3\n    }\n}\n\ndef adjust_params(current_params, direction, strategy='images'):\n    \"\"\"Apply adjustment to parameters\"\"\"\n    adjusted = current_params.copy()\n    strat = ADJUSTMENT_STRATEGIES[strategy]\n    \n    if direction == 'shrink':\n        param = strat['param']\n        current_val = adjusted.get(param, 1.0)\n        new_val = max(current_val - strat['step'], strat['min'])\n        adjusted[param] = new_val\n    \n    return adjusted\n```\n\n### Step 5: Iterative Correction Loop\n\n```python\ndef create_pdf_with_validation(\n    output_path, \n    initial_params, \n    target_max_pages,\n    max_iterations=5\n):\n    \"\"\"\n    Create PDF with iterative page count verification and correction\n    \n    Args:\n        output_path: Where to save the final PDF\n        initial_params: Starting layout parameters\n        target_max_pages: Maximum allowed pages\n        max_iterations: Maximum adjustment attempts\n    \n    Returns:\n        dict with 'success', 'final_page_count', 'iterations', 'final_params'\n    \"\"\"\n    params = initial_params.copy()\n    \n    for iteration in range(max_iterations):\n        # Create PDF\n        create_pdf(output_path, params)\n        \n        # Verify\n        page_count = verify_page_count(output_path)\n        \n        # Check requirements\n        meets_req, direction = check_page_requirement(\n            page_count, target_max_pages\n        )\n        \n        if meets_req:\n            print(f\"✓ PDF created successfully: {page_count} pages\")\n            return {\n                'success': True,\n                'final_page_count': page_count,\n                'iterations': iteration + 1,\n                'final_params': params\n            }\n        \n        # Adjust and retry\n        print(f\"Iteration {iteration + 1}: {page_count} pages (need ≤{target_max_pages})\")\n        params = adjust_params(params, direction)\n    \n    # Failed to converge\n    return {\n        'success': False,\n        'final_page_count': page_count,\n        'iterations': max_iterations,\n        'final_params': params,\n        'error': f\"Failed to meet page requirement after {max_iterations} iterations\"\n    }\n```\n\n## Example Usage\n\n```python\n# Initial parameters\nparams = {\n    'image_scale': 1.0,\n    'font_size': 10,\n    'margin_inches': 0.5,\n    'rows_per_page': 15\n}\n\n# Create map PDF limited to 1 page\nresult = create_pdf_with_validation(\n    output_path='property_map.pdf',\n    initial_params=params,\n    target_max_pages=1,\n    max_iterations=5\n)\n\nif not result['success']:\n    # Consider more aggressive adjustments or content reduction\n    print(f\"Warning: {result['error']}\")\n```\n\n## Tips\n\n1. **Prioritize adjustments**: Start with less intrusive changes (margins, image scale) before more significant ones (font size, content removal)\n\n2. **Track iteration history**: Log each iteration's parameters and page count to identify which adjustments are most effective\n\n3. **Set reasonable limits**: Don't reduce parameters below readable\u002Fviewable thresholds\n\n4. **Consider content-based solutions**: If layout adjustments fail, consider removing or summarizing content\n\n5. **Use multiple strategies sequentially**: Try image reduction first, then table density, then fonts\n\n## Common Adjustment Order\n\n1. Reduce margins (least visible impact)\n2. Reduce image sizes\n3. Reduce table density \u002F increase pagination\n4. Reduce font sizes\n5. Remove or summarize content (last resort)",{"name":5,"description":7},"main","ff671ef61ed6587c49bd54c81cdc751c0b99e363","gdpval_bench\u002Fskills\u002Fpdf-page-verification-correction","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace","https:\u002F\u002Fgithub.com\u002FAG064","AG064, E.Mi.\r\n\r\nA person who thinks all the time, yet all they have to think about is nothing. I want to improve the world and work on open source projects","2026-10-08 06:53:48",{"source":8,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add AG064\u002FOpenSpace --skill pdf-page-verification-correction",{"tool":50,"command":51},"bunx","bunx skills add AG064\u002FOpenSpace --skill pdf-page-verification-correction",{"tool":53,"command":54},"pnpm","pnpm dlx skills add AG064\u002FOpenSpace --skill pdf-page-verification-correction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-page-verification-correction\u002FSKILL.md",true,[58],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},".skill_id","OTHER","其他",46,"https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fgdpval_bench\u002Fskills\u002Fpdf-page-verification-correction\u002F.skill_id",[65,89,105,114,144,160],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":32},"01M6KKMPWA0B5SCCH766F8M5EA","write-special-chars-ts-check","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, plus a reliable TypeScript type-checking step that filters output to only the newly-written files to avoid being misled by pre-existing errors.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-ts-check\u002FSKILL.md",[],[72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88],"write special chars ts check","check","write","filters","Existing","type-checking","for","errors","script","output","type","files","only","template","file","python","typescript",{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":32},"01M6KKMJXVBNVEY3TRK055F4A7","write-special-chars-readback","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) using a Python heredoc script, with mandatory post-write verification via read_file and cleanup of \u002Ftmp helper scripts.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-readback\u002FSKILL.md",[],[96,97,74,85,98,99,86,87,100,24,101,102,103,78,80,104],"readback","write special chars readback","cleanup","read","scripts","via","post","helper","with",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":32},"01M6KKMEGX9M9NC105J0W3Q5B9","write-special-chars-heredoc","Workaround for write_file failures caused by special characters (apostrophes, backticks, template literals) by using a Python heredoc script executed via shell.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fwrite-special-chars-heredoc\u002FSKILL.md",[],[74,112,87,78,101,85,113,86,80],"write special chars heredoc","shell",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":125,"publishedAt":32},"01M6KKM8EJ2AATVHZBNB916WT0","worldmonitor-reference","Curated architecture index of the WorldMonitor open-source dashboard. Reference for extracting patterns — vanilla TypeScript, Panel class hierarchy, service layer, CSS grid, API edge functions, refresh scheduler, and 60+ data source integrations.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fworldmonitor-reference\u002FSKILL.md",[120],{"categoryNo":121,"categoryName":122,"taxonomyType":123,"taxonomyTypeDesc":124},"01JBSEEDCAT000000000000033","数据分析师","PROFESSION","适用职业",[126,127,128,129,88,130,131,132,133,134,78,135,136,137,138,139,140,141,142,143],"reference","worldmonitor","worldmonitor reference","dashboard","css","architecture","extracting","hierarchy","source","layer","panel","patterns","edge functions","integrations","open","api","data","scheduler",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":32},"01M6KKM39PHYK627F19GE2B9XN","virtual-list","Implement efficient virtual scrolling for rendering large lists with DOM recycling, chunk-based rendering, and performance optimizations","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fvirtual-list\u002FSKILL.md",[],[151,152,153,154,78,155,104,156,157,158,159],"virtual list","list","virtual","chunk","dom","rendering","recycling","implement","performance",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":32},"01M6KKKY7T2P61Y0JH54CDEJKQ","verify-directory-structure","Diagnose and resolve file access issues by first verifying the directory structure.","https:\u002F\u002Fgithub.com\u002FAG064\u002FOpenSpace\u002Fblob\u002Fmain\u002Fshowcase\u002Fskills\u002Fverify-directory-structure\u002FSKILL.md",[],[167,28,168,169,170,171,86,172,173,174],"directory","structure","verify directory structure","access","first","issues","diagnose","file access"]