[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M699MXBF278MXXDCAHSY3BP8":3,"skill-same:01M699MXBF278MXXDCAHSY3BP8":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":59,"repositoryHtmlUrl":60,"repositoryHomepageUrl":61,"ownerHtmlUrl":62,"ownerBlogUrl":63,"ownerDescription":64,"updatedAt":65,"install":66,"resources":78},"01M699MXBF278MXXDCAHSY3BP8","add-pdf-report",null,"Internal implementation skill invoked by \u002Fadd-native for app-generated PDF report workflows using expo-print and, when present, expo-sharing.","microsoft\u002Fpower-platform-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M699JVYJFB75D9JM70BN4H0Q",1149,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-apps\u002Fskills\u002Fadd-native\u002Fadd-pdf-report\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"add pdf report","report","pdf report","add","PDF","present","when","for","true","sonnet","native","false","app","expo","generated","edit","write","read","Bash","workflows","2026-11-10 10:12:30",false,"---\nname: add-pdf-report\ndescription: Internal implementation skill invoked by \u002Fadd-native for app-generated PDF report workflows using expo-print and, when present, expo-sharing.\nuser-invocable: false\ndisable-model-invocation: true\nallowed-tools: Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion\nmodel: sonnet\n---\n\n**Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}\u002Fshared\u002Fshared-instructions.md)** - read first.\n\n**Working directory:** before any project read or command, execute\n[native-artifact-compatibility.md Step 0](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fnative-artifact-compatibility.md#0-bind-every-operation-to-the-app-root).\nInherit `\u002Fadd-native`'s resolved absolute `working_dir`; bind every shell call and\nfile tool to it, even when this helper starts from another directory.\n\n# Add PDF Report\n\n**Internal helper.** Users should invoke `\u002Fadd-native pdf-report`, `\u002Fadd-native generate-pdf`, or `\u002Fadd-native pdf-export`; `\u002Fadd-native` routes here after resolving the capability.\n\nGenerate or verify a local PDF report wrapper for app-owned PDFs created from records, evidence, certificates, receipts, or summaries. This helper uses `expo-print` to create a local PDF file URI. It may use `expo-sharing` only when that package is already present. It never installs packages or imports the native PDF viewer directly.\n\n## Capability boundaries\n\n| User need | Correct path |\n|---|---|\n| Generate\u002Fexport\u002Fprint a report from app data | This helper: `expo-print` -> local PDF URI |\n| Share the generated local PDF from the device | Add share method only if `expo-sharing` is already in `package.json` |\n| Retain the generated PDF in Dataverse | Create\u002Fupdate parent row first, then upload to a Dataverse File column with generated services |\n| Open an existing HTTPS or local file PDF in the Power Apps native viewer | `\u002Fadd-native pdf-viewer`, only if `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+ is already present |\n| Pick\u002Fimport\u002Fupload a user-selected PDF | `\u002Fadd-native document-picker` or host `\u003CFilePicker>` for Dataverse File columns |\n\nLocal generated PDFs are usually `file:\u002F\u002F` URIs and can be passed to `openHttpsPdf(...)` with `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+.\n\n## Steps\n\n### 1. Verify app\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\ntest -f app.config.js && test -f power.config.json && test -f package.json && test -d src || { echo \"BLOCKED: working_dir is not an initialized app\" >&2; exit 1; }\n```\n\nIf this fails, tell the user to run `\u002Fcreate-mobile-app` first and STOP.\n\n### 2. Verify packages are already present\n\n`expo-print` is required. `expo-sharing` is optional unless the plan specifically needs sharing behavior.\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode -e \"const p=require('.\u002Fpackage.json'); const deps={...p.dependencies,...p.devDependencies}; const required='expo-print'; if (!deps[required]) { console.error('MISSING: expo-print is not in package.json. The template\u002Fapp must already ship it for \u002Fadd-native pdf-report. This skill will not install it or edit native config. Capability not added.'); process.exit(1); } console.log('OK: expo-print package present'); console.log(deps['expo-sharing'] ? 'OK: expo-sharing package present' : 'OPTIONAL_MISSING: expo-sharing is not in package.json; generated PDFs can be created\u002Fviewed\u002Fuploaded, but sharing helpers must not be generated.');\"\n```\n\nIf `expo-print` is missing, STOP. Do not run `npm install`, `npx expo install`, `pod install`, or edit `app.config.js`. Do not add `pdf-report` to the plan or generated wrappers for this app.\n\nIf `expo-sharing` is missing:\n\n- Continue for generate-only, native-viewer preview, or Dataverse-upload flows.\n- Do not import `expo-sharing`.\n- Do not generate `sharePdfReport(...)`.\n- If the user's requirement specifically includes sharing, STOP and say sharing is not supported by this template.\n\n### 2a. Reconcile requested artifacts\n\nRead and execute [native-artifact-compatibility.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fnative-artifact-compatibility.md)\nSteps 1–3 for the PDF report row before any writes or reuse. Inherit the current\napproval\u002Fmode from `\u002Fadd-native`; do not repeat a valid scoped approval.\nInspect `src\u002Fnative\u002FpdfReport.ts` for the full requested API: `createPdfReport`,\n`wrapPdfDocument`, `escapePdfHtml`, requested `includeBase64` output for retention,\nand `sharePdfReport`\u002F`PdfShareResult` when sharing is approved. Generate-only\ncompatibility does not satisfy a share\u002Fupload request. Verify local-file and\ngenerated File-service payload requirements; missing required storage or an\nincompatible artifact outside approval returns `NEEDS_CONTEXT` to the owner, or\nasks standalone.\n\n### 3. Write or verify `src\u002Fnative\u002FpdfReport.ts`\n\nApply Step 2a's decision for `src\u002Fnative\u002FpdfReport.ts`: create when requested and\nmissing, reuse unchanged only if compatible, or make only the approved scoped\nupdate. Preserve custom HTML logic and existing exports; the example is not an\noverwrite template.\n\nThe wrapper MUST:\n\n- Import `expo-print` only after Step 2 confirms it is present.\n- Import `expo-sharing` only when Step 2 confirms it is present.\n- Return discriminated unions and never throw.\n- Treat generated local PDFs as local files for view\u002Fshare\u002Fupload flows.\n- Never import `@microsoft\u002Fpower-apps-native-pdf-viewer` directly from this wrapper.\n- Keep HTML generation deterministic and app-owned; do not fetch remote HTML inside the wrapper.\n\nBase wrapper when sharing is requested and `expo-sharing` is present:\n\n```ts\n\u002F\u002F src\u002Fnative\u002FpdfReport.ts\nimport * as Print from 'expo-print';\nimport * as Sharing from 'expo-sharing';\n\nexport type PdfReportResult =\n  | { ok: true; uri: string; numberOfPages?: number; base64?: string }\n  | { ok: false; reason: 'EMPTY_HTML' | 'PRINT_FAILED'; message?: string };\n\nexport type PdfShareResult =\n  | { ok: true }\n  | { ok: false; reason: 'INVALID_URI' | 'SHARING_UNAVAILABLE' | 'SHARE_FAILED'; message?: string };\n\nexport function escapePdfHtml(value: string): string {\n  return value\n    .replace(\u002F&\u002Fg, '&amp;')\n    .replace(\u002F\u003C\u002Fg, '&lt;')\n    .replace(\u002F>\u002Fg, '&gt;')\n    .replace(\u002F\"\u002Fg, '&quot;')\n    .replace(\u002F'\u002Fg, '&#39;');\n}\n\nexport function wrapPdfDocument(input: { title: string; bodyHtml: string; styles?: string }): string {\n  const title = escapePdfHtml(input.title.trim() || 'Report');\n  return `\u003C!doctype html>\n\u003Chtml>\n  \u003Chead>\n    \u003Cmeta charset=\"utf-8\" \u002F>\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" \u002F>\n    \u003Ctitle>${title}\u003C\u002Ftitle>\n    \u003Cstyle>\n      body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; margin: 32px; color: #111827; }\n      h1, h2, h3 { margin: 0 0 12px; }\n      table { width: 100%; border-collapse: collapse; }\n      th, td { border-bottom: 1px solid #e5e7eb; padding: 8px; text-align: left; }\n      ${input.styles ?? ''}\n    \u003C\u002Fstyle>\n  \u003C\u002Fhead>\n  \u003Cbody>${input.bodyHtml}\u003C\u002Fbody>\n\u003C\u002Fhtml>`;\n}\n\nexport async function createPdfReport(\n  html: string,\n  options?: { includeBase64?: boolean },\n): Promise\u003CPdfReportResult> {\n  if (!html.trim()) {\n    return { ok: false, reason: 'EMPTY_HTML', message: 'PDF report HTML is empty.' };\n  }\n\n  try {\n    const result = await Print.printToFileAsync({\n      html,\n      base64: options?.includeBase64 ?? false,\n    });\n\n    return {\n      ok: true,\n      uri: result.uri,\n      numberOfPages: result.numberOfPages,\n      base64: result.base64,\n    };\n  } catch (error: any) {\n    return { ok: false, reason: 'PRINT_FAILED', message: error?.message ?? String(error) };\n  }\n}\n\nexport async function sharePdfReport(uri: string, options?: { dialogTitle?: string }): Promise\u003CPdfShareResult> {\n  if (!uri || !uri.startsWith('file:\u002F\u002F')) {\n    return { ok: false, reason: 'INVALID_URI', message: 'Generated PDF reports must be shared from a local file URI.' };\n  }\n\n  try {\n    const available = await Sharing.isAvailableAsync();\n    if (!available) {\n      return { ok: false, reason: 'SHARING_UNAVAILABLE', message: 'Sharing is not available on this platform.' };\n    }\n\n    await Sharing.shareAsync(uri, {\n      mimeType: 'application\u002Fpdf',\n      UTI: 'com.adobe.pdf',\n      dialogTitle: options?.dialogTitle ?? 'Share PDF report',\n    });\n\n    return { ok: true };\n  } catch (error: any) {\n    return { ok: false, reason: 'SHARE_FAILED', message: error?.message ?? String(error) };\n  }\n}\n```\n\nFor a new generate-only wrapper (or when `expo-sharing` is absent), omit the\n`expo-sharing` import, `PdfShareResult`, and `sharePdfReport(...)`. Keep\n`createPdfReport(...)`, `wrapPdfDocument(...)`, and `escapePdfHtml(...)`. Do not\nremove compatible existing share exports merely because sharing is not requested\nthis time; any incompatible existing import follows Step 2a's scoped-update gate.\n\n### 4. Use the wrapper\n\nIntegration guidance for the owner, not instructions to edit screens here.\nScreens import the wrapper, not Expo modules directly. This example includes\nsharing only when approved and available:\n\n```ts\nimport { createPdfReport, escapePdfHtml, sharePdfReport, wrapPdfDocument } from '@\u002Fnative\u002FpdfReport';\n\nconst html = wrapPdfDocument({\n  title: 'Inspection report',\n  bodyHtml: `\u003Ch1>Inspection report\u003C\u002Fh1>\u003Cp>${escapePdfHtml(summary)}\u003C\u002Fp>`,\n});\n\nconst report = await createPdfReport(html);\nif (!report.ok) {\n  showError(report.message ?? 'Report PDF was not generated.');\n  return;\n}\n\nconst share = await sharePdfReport(report.uri, { dialogTitle: 'Share inspection report' });\nif (!share.ok) {\n  showError(share.message ?? 'Report PDF was generated but could not be shared.');\n}\n```\n\nIf `expo-sharing` is absent, screens may still call `createPdfReport(...)`, preview the returned `file:\u002F\u002F` URI through native PDF viewer 0.2.9+, or upload it to a Dataverse File column through generated services. They must not render a Share button.\n\n### 5. Optional Dataverse upload\n\nOptional means unrequested, not skippable when retention is approved. Step 2a\nverifies wrapper payload support and the generated signature; the owner supplies\nthe app-specific adapter\u002Fscreen integration below. Return missing helper-owned\nsupport or unknown required storage as `NEEDS_CONTEXT`, not a capture-only success.\n\nRetained PDFs use Dataverse File columns. Save or update the parent row first, verify `success`, then upload a payload compatible with the generated service's `upload(id, columnName, file, fileDisplayName?)` signature. Never put File column bytes in create\u002Fupdate JSON.\n\n```ts\nconst save = await Cr123_inspectionService.update(inspectionId, {\n  cr123_reportgeneratedat: new Date().toISOString(),\n});\n\nif (!save.success) {\n  showError(save.error?.message ?? 'Inspection was not saved.');\n  return;\n}\n\nconst report = await createPdfReport(html, { includeBase64: true });\nif (!report.ok) {\n  showError(report.message ?? 'Report PDF was not generated.');\n  return;\n}\n\nif (!report.base64) {\n  showError('Report PDF was generated but could not be prepared for upload.');\n  return;\n}\n\n\u002F\u002F Convert report.base64 into the File\u002Fblob\u002Fpicked-file shape expected by the generated service.\n\u002F\u002F Do not pass report.uri unless the generated service explicitly documents URI support.\nconst reportFile = createUploadFileFromBase64(report.base64, 'inspection-report.pdf', 'application\u002Fpdf');\n\nconst upload = await Cr123_inspectionService.upload(\n  inspectionId,\n  'cr123_reportfile',\n  reportFile,\n  'inspection-report.pdf',\n);\nif (!upload.success) {\n  showError(upload.error?.message ?? 'Report PDF was not uploaded.');\n}\n```\n\n`createUploadFileFromBase64(...)` is intentionally app-specific because generated upload helpers may expect a browser `File`, a host `PickedFileInfo`, bytes, or another service-specific payload shape. Use the model\u002Fservice types generated for that table and do not edit generated services.\n\n### 6. Type-check\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpx --no-install tsc --noEmit\n```\n\nFix only in-scope helper errors, then execute the shared compatibility contract's\nStep 4. Recheck requested generation, sharing, and retention payloads, including\nempty HTML, unavailable sharing, print\u002Fshare failures, and absent required base64.\nType-check success alone is insufficient; do not fix screen\u002Fgenerated files.\n\n### 7. Native rebuild note\n\nThis skill does not install native code. If `expo-print` or `expo-sharing` was just added outside the skill, the app needs a native rebuild outside this workflow. If the packages were already in the build, Metro hot reload is enough for wrapper edits.\n\n### 8. Summary\n\nReturn the shared compatibility result and actual created\u002Fupdated\u002Freused paths\nbefore this summary. Report owner-side upload\u002Fintegration separately; update\nmemory-bank only after success, and leave final updates to the owner when orchestrated.\n\nTell the user:\n\n```text\nPDF report helper added\nRequired package : expo-print\nOptional share   : expo-sharing \u003Cpresent | absent>\nWrapper          : src\u002Fnative\u002FpdfReport.ts\nOutput           : local PDF file URI\nNative viewer    : optional; 0.2.9+ can open the generated file:\u002F\u002F URI\nType-check       : PASS\nNative rebuild   : not performed by this skill\n```\n\nUpdate `memory-bank.md` under `Controls`:\n\n```text\n- PDF report helper added - expo-print local generation, expo-sharing \u003Cpresent|absent> (\u003CISO date>)\n```","**Shared instructions: [shared-instructions.md](${PLUGIN_ROOT}\u002Fshared\u002Fshared-instructions.md)** - read first.\n\n**Working directory:** before any project read or command, execute\n[native-artifact-compatibility.md Step 0](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fnative-artifact-compatibility.md#0-bind-every-operation-to-the-app-root).\nInherit `\u002Fadd-native`'s resolved absolute `working_dir`; bind every shell call and\nfile tool to it, even when this helper starts from another directory.\n\n# Add PDF Report\n\n**Internal helper.** Users should invoke `\u002Fadd-native pdf-report`, `\u002Fadd-native generate-pdf`, or `\u002Fadd-native pdf-export`; `\u002Fadd-native` routes here after resolving the capability.\n\nGenerate or verify a local PDF report wrapper for app-owned PDFs created from records, evidence, certificates, receipts, or summaries. This helper uses `expo-print` to create a local PDF file URI. It may use `expo-sharing` only when that package is already present. It never installs packages or imports the native PDF viewer directly.\n\n## Capability boundaries\n\n| User need | Correct path |\n|---|---|\n| Generate\u002Fexport\u002Fprint a report from app data | This helper: `expo-print` -> local PDF URI |\n| Share the generated local PDF from the device | Add share method only if `expo-sharing` is already in `package.json` |\n| Retain the generated PDF in Dataverse | Create\u002Fupdate parent row first, then upload to a Dataverse File column with generated services |\n| Open an existing HTTPS or local file PDF in the Power Apps native viewer | `\u002Fadd-native pdf-viewer`, only if `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+ is already present |\n| Pick\u002Fimport\u002Fupload a user-selected PDF | `\u002Fadd-native document-picker` or host `\u003CFilePicker>` for Dataverse File columns |\n\nLocal generated PDFs are usually `file:\u002F\u002F` URIs and can be passed to `openHttpsPdf(...)` with `@microsoft\u002Fpower-apps-native-pdf-viewer` 0.2.9+.\n\n## Steps\n\n### 1. Verify app\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\ntest -f app.config.js && test -f power.config.json && test -f package.json && test -d src || { echo \"BLOCKED: working_dir is not an initialized app\" >&2; exit 1; }\n```\n\nIf this fails, tell the user to run `\u002Fcreate-mobile-app` first and STOP.\n\n### 2. Verify packages are already present\n\n`expo-print` is required. `expo-sharing` is optional unless the plan specifically needs sharing behavior.\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnode -e \"const p=require('.\u002Fpackage.json'); const deps={...p.dependencies,...p.devDependencies}; const required='expo-print'; if (!deps[required]) { console.error('MISSING: expo-print is not in package.json. The template\u002Fapp must already ship it for \u002Fadd-native pdf-report. This skill will not install it or edit native config. Capability not added.'); process.exit(1); } console.log('OK: expo-print package present'); console.log(deps['expo-sharing'] ? 'OK: expo-sharing package present' : 'OPTIONAL_MISSING: expo-sharing is not in package.json; generated PDFs can be created\u002Fviewed\u002Fuploaded, but sharing helpers must not be generated.');\"\n```\n\nIf `expo-print` is missing, STOP. Do not run `npm install`, `npx expo install`, `pod install`, or edit `app.config.js`. Do not add `pdf-report` to the plan or generated wrappers for this app.\n\nIf `expo-sharing` is missing:\n\n- Continue for generate-only, native-viewer preview, or Dataverse-upload flows.\n- Do not import `expo-sharing`.\n- Do not generate `sharePdfReport(...)`.\n- If the user's requirement specifically includes sharing, STOP and say sharing is not supported by this template.\n\n### 2a. Reconcile requested artifacts\n\nRead and execute [native-artifact-compatibility.md](${PLUGIN_ROOT}\u002Fshared\u002Freferences\u002Fnative-artifact-compatibility.md)\nSteps 1–3 for the PDF report row before any writes or reuse. Inherit the current\napproval\u002Fmode from `\u002Fadd-native`; do not repeat a valid scoped approval.\nInspect `src\u002Fnative\u002FpdfReport.ts` for the full requested API: `createPdfReport`,\n`wrapPdfDocument`, `escapePdfHtml`, requested `includeBase64` output for retention,\nand `sharePdfReport`\u002F`PdfShareResult` when sharing is approved. Generate-only\ncompatibility does not satisfy a share\u002Fupload request. Verify local-file and\ngenerated File-service payload requirements; missing required storage or an\nincompatible artifact outside approval returns `NEEDS_CONTEXT` to the owner, or\nasks standalone.\n\n### 3. Write or verify `src\u002Fnative\u002FpdfReport.ts`\n\nApply Step 2a's decision for `src\u002Fnative\u002FpdfReport.ts`: create when requested and\nmissing, reuse unchanged only if compatible, or make only the approved scoped\nupdate. Preserve custom HTML logic and existing exports; the example is not an\noverwrite template.\n\nThe wrapper MUST:\n\n- Import `expo-print` only after Step 2 confirms it is present.\n- Import `expo-sharing` only when Step 2 confirms it is present.\n- Return discriminated unions and never throw.\n- Treat generated local PDFs as local files for view\u002Fshare\u002Fupload flows.\n- Never import `@microsoft\u002Fpower-apps-native-pdf-viewer` directly from this wrapper.\n- Keep HTML generation deterministic and app-owned; do not fetch remote HTML inside the wrapper.\n\nBase wrapper when sharing is requested and `expo-sharing` is present:\n\n```ts\n\u002F\u002F src\u002Fnative\u002FpdfReport.ts\nimport * as Print from 'expo-print';\nimport * as Sharing from 'expo-sharing';\n\nexport type PdfReportResult =\n  | { ok: true; uri: string; numberOfPages?: number; base64?: string }\n  | { ok: false; reason: 'EMPTY_HTML' | 'PRINT_FAILED'; message?: string };\n\nexport type PdfShareResult =\n  | { ok: true }\n  | { ok: false; reason: 'INVALID_URI' | 'SHARING_UNAVAILABLE' | 'SHARE_FAILED'; message?: string };\n\nexport function escapePdfHtml(value: string): string {\n  return value\n    .replace(\u002F&\u002Fg, '&amp;')\n    .replace(\u002F\u003C\u002Fg, '&lt;')\n    .replace(\u002F>\u002Fg, '&gt;')\n    .replace(\u002F\"\u002Fg, '&quot;')\n    .replace(\u002F'\u002Fg, '&#39;');\n}\n\nexport function wrapPdfDocument(input: { title: string; bodyHtml: string; styles?: string }): string {\n  const title = escapePdfHtml(input.title.trim() || 'Report');\n  return `\u003C!doctype html>\n\u003Chtml>\n  \u003Chead>\n    \u003Cmeta charset=\"utf-8\" \u002F>\n    \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\" \u002F>\n    \u003Ctitle>${title}\u003C\u002Ftitle>\n    \u003Cstyle>\n      body { font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif; margin: 32px; color: #111827; }\n      h1, h2, h3 { margin: 0 0 12px; }\n      table { width: 100%; border-collapse: collapse; }\n      th, td { border-bottom: 1px solid #e5e7eb; padding: 8px; text-align: left; }\n      ${input.styles ?? ''}\n    \u003C\u002Fstyle>\n  \u003C\u002Fhead>\n  \u003Cbody>${input.bodyHtml}\u003C\u002Fbody>\n\u003C\u002Fhtml>`;\n}\n\nexport async function createPdfReport(\n  html: string,\n  options?: { includeBase64?: boolean },\n): Promise\u003CPdfReportResult> {\n  if (!html.trim()) {\n    return { ok: false, reason: 'EMPTY_HTML', message: 'PDF report HTML is empty.' };\n  }\n\n  try {\n    const result = await Print.printToFileAsync({\n      html,\n      base64: options?.includeBase64 ?? false,\n    });\n\n    return {\n      ok: true,\n      uri: result.uri,\n      numberOfPages: result.numberOfPages,\n      base64: result.base64,\n    };\n  } catch (error: any) {\n    return { ok: false, reason: 'PRINT_FAILED', message: error?.message ?? String(error) };\n  }\n}\n\nexport async function sharePdfReport(uri: string, options?: { dialogTitle?: string }): Promise\u003CPdfShareResult> {\n  if (!uri || !uri.startsWith('file:\u002F\u002F')) {\n    return { ok: false, reason: 'INVALID_URI', message: 'Generated PDF reports must be shared from a local file URI.' };\n  }\n\n  try {\n    const available = await Sharing.isAvailableAsync();\n    if (!available) {\n      return { ok: false, reason: 'SHARING_UNAVAILABLE', message: 'Sharing is not available on this platform.' };\n    }\n\n    await Sharing.shareAsync(uri, {\n      mimeType: 'application\u002Fpdf',\n      UTI: 'com.adobe.pdf',\n      dialogTitle: options?.dialogTitle ?? 'Share PDF report',\n    });\n\n    return { ok: true };\n  } catch (error: any) {\n    return { ok: false, reason: 'SHARE_FAILED', message: error?.message ?? String(error) };\n  }\n}\n```\n\nFor a new generate-only wrapper (or when `expo-sharing` is absent), omit the\n`expo-sharing` import, `PdfShareResult`, and `sharePdfReport(...)`. Keep\n`createPdfReport(...)`, `wrapPdfDocument(...)`, and `escapePdfHtml(...)`. Do not\nremove compatible existing share exports merely because sharing is not requested\nthis time; any incompatible existing import follows Step 2a's scoped-update gate.\n\n### 4. Use the wrapper\n\nIntegration guidance for the owner, not instructions to edit screens here.\nScreens import the wrapper, not Expo modules directly. This example includes\nsharing only when approved and available:\n\n```ts\nimport { createPdfReport, escapePdfHtml, sharePdfReport, wrapPdfDocument } from '@\u002Fnative\u002FpdfReport';\n\nconst html = wrapPdfDocument({\n  title: 'Inspection report',\n  bodyHtml: `\u003Ch1>Inspection report\u003C\u002Fh1>\u003Cp>${escapePdfHtml(summary)}\u003C\u002Fp>`,\n});\n\nconst report = await createPdfReport(html);\nif (!report.ok) {\n  showError(report.message ?? 'Report PDF was not generated.');\n  return;\n}\n\nconst share = await sharePdfReport(report.uri, { dialogTitle: 'Share inspection report' });\nif (!share.ok) {\n  showError(share.message ?? 'Report PDF was generated but could not be shared.');\n}\n```\n\nIf `expo-sharing` is absent, screens may still call `createPdfReport(...)`, preview the returned `file:\u002F\u002F` URI through native PDF viewer 0.2.9+, or upload it to a Dataverse File column through generated services. They must not render a Share button.\n\n### 5. Optional Dataverse upload\n\nOptional means unrequested, not skippable when retention is approved. Step 2a\nverifies wrapper payload support and the generated signature; the owner supplies\nthe app-specific adapter\u002Fscreen integration below. Return missing helper-owned\nsupport or unknown required storage as `NEEDS_CONTEXT`, not a capture-only success.\n\nRetained PDFs use Dataverse File columns. Save or update the parent row first, verify `success`, then upload a payload compatible with the generated service's `upload(id, columnName, file, fileDisplayName?)` signature. Never put File column bytes in create\u002Fupdate JSON.\n\n```ts\nconst save = await Cr123_inspectionService.update(inspectionId, {\n  cr123_reportgeneratedat: new Date().toISOString(),\n});\n\nif (!save.success) {\n  showError(save.error?.message ?? 'Inspection was not saved.');\n  return;\n}\n\nconst report = await createPdfReport(html, { includeBase64: true });\nif (!report.ok) {\n  showError(report.message ?? 'Report PDF was not generated.');\n  return;\n}\n\nif (!report.base64) {\n  showError('Report PDF was generated but could not be prepared for upload.');\n  return;\n}\n\n\u002F\u002F Convert report.base64 into the File\u002Fblob\u002Fpicked-file shape expected by the generated service.\n\u002F\u002F Do not pass report.uri unless the generated service explicitly documents URI support.\nconst reportFile = createUploadFileFromBase64(report.base64, 'inspection-report.pdf', 'application\u002Fpdf');\n\nconst upload = await Cr123_inspectionService.upload(\n  inspectionId,\n  'cr123_reportfile',\n  reportFile,\n  'inspection-report.pdf',\n);\nif (!upload.success) {\n  showError(upload.error?.message ?? 'Report PDF was not uploaded.');\n}\n```\n\n`createUploadFileFromBase64(...)` is intentionally app-specific because generated upload helpers may expect a browser `File`, a host `PickedFileInfo`, bytes, or another service-specific payload shape. Use the model\u002Fservice types generated for that table and do not edit generated services.\n\n### 6. Type-check\n\n```bash\ncd -- '\u003Cworking_dir>' || { echo \"BLOCKED: cannot enter working_dir\" >&2; exit 1; }\nnpx --no-install tsc --noEmit\n```\n\nFix only in-scope helper errors, then execute the shared compatibility contract's\nStep 4. Recheck requested generation, sharing, and retention payloads, including\nempty HTML, unavailable sharing, print\u002Fshare failures, and absent required base64.\nType-check success alone is insufficient; do not fix screen\u002Fgenerated files.\n\n### 7. Native rebuild note\n\nThis skill does not install native code. If `expo-print` or `expo-sharing` was just added outside the skill, the app needs a native rebuild outside this workflow. If the packages were already in the build, Metro hot reload is enough for wrapper edits.\n\n### 8. Summary\n\nReturn the shared compatibility result and actual created\u002Fupdated\u002Freused paths\nbefore this summary. Report owner-side upload\u002Fintegration separately; update\nmemory-bank only after success, and leave final updates to the owner when orchestrated.\n\nTell the user:\n\n```text\nPDF report helper added\nRequired package : expo-print\nOptional share   : expo-sharing \u003Cpresent | absent>\nWrapper          : src\u002Fnative\u002FpdfReport.ts\nOutput           : local PDF file URI\nNative viewer    : optional; 0.2.9+ can open the generated file:\u002F\u002F URI\nType-check       : PASS\nNative rebuild   : not performed by this skill\n```\n\nUpdate `memory-bank.md` under `Controls`:\n\n```text\n- PDF report helper added - expo-print local generation, expo-sharing \u003Cpresent|absent> (\u003CISO date>)\n```",{"name":5,"model":38,"description":7,"allowed-tools":54,"user-invocable":50,"disable-model-invocation":55},"Read, Edit, Write, Grep, Glob, Bash, AskUserQuestion",true,"main","0a55a88fa2855404029d1e5450faf92878baf763","plugins\u002Fmobile-apps\u002Fskills\u002Fadd-native\u002Fadd-pdf-report",232,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills","https:\u002F\u002Fmicrosoft.github.io\u002Fpower-platform-skills\u002F","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 21:46:39",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":55},[68,71,74],{"tool":69,"command":70},"npx","npx skills add microsoft\u002Fpower-platform-skills --skill add-pdf-report",{"tool":72,"command":73},"bunx","bunx skills add microsoft\u002Fpower-platform-skills --skill add-pdf-report",{"tool":75,"command":76},"pnpm","pnpm dlx skills add microsoft\u002Fpower-platform-skills --skill add-pdf-report","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-apps\u002Fskills\u002Fadd-native\u002Fadd-pdf-report\u002FSKILL.md",[79,85],{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Fcache\u002Fskills_cache.json","SCRIPT","脚本",41976,"https:\u002F\u002Fgithub.com\u002Fmattwag05\u002Fmw-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Finternet-skill-finder\u002Fskills\u002Finternet-skill-finder\u002Fscripts\u002Fcache\u002Fskills_cache.json",{"path":86,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":87,"sourceHtmlUrl":88},"scripts\u002Ffetch_skills.py",17203,"https:\u002F\u002Fgithub.com\u002Fmattwag05\u002Fmw-plugins\u002Fblob\u002Fmain\u002Fplugins\u002Finternet-skill-finder\u002Fskills\u002Finternet-skill-finder\u002Fscripts\u002Ffetch_skills.py",[90,98,117,134,152,166],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":97},"01M78JN2BFRRV1J54Q6WKZQ08D","compare-site-configurations","Compare Power Pages site configurations between two environments, such as dev, test and production, or between a local download and the live site, and explain which differences change site behavior. Use when a site works in one environment but not another (for example, works in dev but fails in test), to check configuration drift before promoting or deploying, or to see what changed between two sites. Produces a shareable HTML report and a JSON file that VS Code can import.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fpower-pages\u002Fskills\u002Fcompare-site-configurations\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":49},"01M699WVHX0XN59EPBTTPEKYPG","setup","Use when Process Intelligence needs building, explicit cloud\u002Faccount\u002Fenvironment configuration, sign-in, connection diagnostics, or recovery from an authentication error.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fsetup\u002FSKILL.md",[],[100,105,106,107,108,109,35,110,111,112,47,113,114,115,46,116],"configuration","diagnostics","error","environment","cloud","connection","authentication","use","recovery","process","sign","intelligence",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":124,"publishedAt":49},"01M699WSR9EX55YY1WD9J22FEG","report-issue","Use when the user wants a Process Intelligence bug-report draft or support summary for a failed operation.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Freport-issue\u002FSKILL.md",[123],{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},[125,30,126,127,112,35,128,129,114,130,116,131,132,36,133],"issue","report issue","bug-report","operation","draft","bug","summary","user","support",{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":49},"01M699WR26YQ9Q21KE6MJF5B2G","investigate-process","Use when a broad Process Mining business question, observed pattern or competing explanation needs investigation across analytical perspectives.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Finvestigate-process\u002FSKILL.md",[],[141,114,142,143,112,144,145,35,146,147,148,46,149,150,151],"investigate","investigate process","question","process mining","business","across","perspectives","mining","pattern","investigation","analytical",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":49},"01M699WP9SDG5ZR12P8VYNXKTN","derive-metric","Use when a requested measure is missing, a saved custom metric needs reuse, or an ephemeral formula or derived scalar is needed.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fderive-metric\u002FSKILL.md",[],[159,160,161,162,163,164,112,35,165,46],"metric","derive metric","missing","formula","custom","reuse","saved",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":49},"01M699WMG5R8P6SMTDAS1TKF9E","compare-cohorts","Use when comparing process cohorts, departments, periods or before-and-after results under matched definitions.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fpower-platform-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fprocess-intelligence\u002Fskills\u002Fcompare-cohorts\u002FSKILL.md",[],[173,174,112,35,175,114,46],"compare","compare cohorts","results"]