syncfusion-blazor-smart-pdf-viewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Syncfusion Blazor Smart PDF Viewer – UI Sample Generator

Syncfusion Blazor Smart PDF Viewer – UI示例生成器

NuGet:
Syncfusion.Blazor.SfSmartPdfViewer
+
Syncfusion.Blazor.Themes

Namespace:
Syncfusion.Blazor.SmartPdfViewer
NuGet:
Syncfusion.Blazor.SfSmartPdfViewer
+
Syncfusion.Blazor.Themes

命名空间:
Syncfusion.Blazor.SmartPdfViewer

Generate C# Code for the User's Project (default)

为用户项目生成C#代码(默认功能)

Trigger keywords: "how to", "add smart pdfviewer", "code sample", "show me", "example", "snippet", "integrate", "component", "create sample", "document summarization", "smart redaction", "smart fill".
Purpose: Generate minimal, copy-pasteable C# and Razor code that the user can integrate directly into their Blazor project.
Workflow:
⚠️ CRITICAL — Feature Support Policy (STRICT MODE):
FUNDAMENTAL RULE: Only generate code using APIs and properties that are EXPLICITLY listed in the reference files. ANY deviation is a VIOLATION.
  • MANDATORY CHECKS BEFORE GENERATING ANY CODE:
    1. Search the reference files for the exact API/property name
    2. Verify it appears in the Method Reference, Properties, or Events tables
    3. If NOT found in ANY reference file, STOP immediately
    4. Do NOT generate or suggest undocumented APIs under any circumstances
  • STRICT ENFORCEMENT - ZERO TOLERANCE:
    • NO custom properties - Only use properties from reference file tables
    • NO invented methods - Only use methods from reference file tables
    • NO workarounds with undefined APIs - Forbidden
    • NO assumptions about undocumented behavior - Forbidden
    • NO alternative implementations using guess-work - Forbidden
    • NO pretending support exists - Forbidden
  • MANDATORY RESPONSE FOR UNSUPPORTED FEATURES:
    • If a requested scenario/feature/API is NOT listed in any reference file, you MUST respond with:
      "This feature is not supported in the current Syncfusion Blazor Smart PDF Viewer implementation."
    • Then list what IS supported from the appropriate reference file
    • Never suggest alternatives unless explicitly documented in reference files
  • REFERENCE FILE HIERARCHY:
    • Each reference file contains complete, authoritative documentation for its domain
    • The tables (Method Reference, Properties, Events) are the SOURCE OF TRUTH
    • Content outside these tables in reference files is explanatory only
    • Do NOT extend beyond what appears in the reference file tables
  • AUDIT YOUR GENERATION:
    • Before providing any code, verify EVERY API used appears in a reference file table
    • Document which reference file each API comes from
    • If you cannot cite a reference file table entry, DELETE that code
  • This is a CRITICAL REQUIREMENT. Violations compromise the skill's integrity and reliability.
触发关键词: "how to", "add smart pdfviewer", "code sample", "show me", "example", "snippet", "integrate", "component", "create sample", "document summarization", "smart redaction", "smart fill"。
用途: 生成可直接复制粘贴到Blazor项目中的极简C#和Razor代码。
工作流程:
⚠️ 关键——功能支持策略(严格模式):
基本原则: 仅使用参考文件中明确列出的API和属性生成代码。任何偏离均属违规。
  • 生成代码前的强制检查:
    1. 在参考文件中搜索确切的API/属性名称
    2. 验证其是否出现在方法参考、属性或事件表中
    3. 如果未在任何参考文件中找到,立即停止
    4. 无论任何情况,均不得生成或建议未文档化的API
  • 严格执行——零容忍:
    • 禁止自定义属性 - 仅使用参考文件表中的属性
    • 禁止自创方法 - 仅使用参考文件表中的方法
    • 禁止使用未定义API的变通方案 - 禁止
    • 禁止对未文档化行为做出假设 - 禁止
    • 禁止基于猜测的替代实现 - 禁止
    • 禁止假装支持不存在的功能 - 禁止
  • 不支持功能的强制响应:
    • 如果请求的场景/功能/API未在任何参考文件中列出,必须回复:
      "This feature is not supported in the current Syncfusion Blazor Smart PDF Viewer implementation."
    • 然后列出参考文件中支持的功能
    • 除非参考文件中明确记录,否则不得建议替代方案
  • 参考文件层级:
    • 每个参考文件包含其领域完整、权威的文档
    • 表格(方法参考、属性、事件)是唯一的事实来源
    • 参考文件中表格以外的内容仅作解释用
    • 不得扩展参考文件表格中未提及的内容
  • 生成内容审核:
    • 在提供任何代码前,验证所用的每个API是否出现在参考文件表格中
    • 记录每个API来自哪个参考文件
    • 如果无法引用参考文件表格条目,删除该代码
  • 这是一项关键要求。违规会损害技能的完整性和可靠性。

Step 1 — Detect the Application Type (REQUIRED - DO NOT SKIP)

步骤1 — 检测应用类型(必填——不得跳过)

  • Use file_search and read_file tools to inspect workspace project files:
    • .csproj
      file (project configuration)
    • Program.cs
      (startup configuration)
    • _Imports.razor
      (namespace imports)
    • App.razor
      (root component)
    • Any existing
      .razor
      files in Components/Pages
  • Output: Confirm the detected application type (e.g., "Blazor WebApp" or "Blazor Server") before proceeding.
  • 使用file_search和read_file工具检查工作区项目文件:
    • .csproj
      文件(项目配置)
    • Program.cs
      (启动配置)
    • _Imports.razor
      (命名空间导入)
    • App.razor
      (根组件)
    • Components/Pages中任何现有的
      .razor
      文件
  • 输出: 在继续之前,确认检测到的应用类型(例如“Blazor WebApp”或“Blazor Server”)。

Step 2 — Generate Code from Reference Files Only (REQUIRED)

步骤2 — 仅从参考文件生成代码(必填)

  • Before generating: Confirm that Steps 1 are complete
  • Read the relevant
    references/*.md
    file(s) for the requested feature
  • Cross-reference EVERY API, property, and method against these tables
  • DECLARATIVE-ONLY APPROACH (MANDATORY - NO LIFECYCLE METHODS):
    • Use ONLY property binding in Razor markup similar lifecycle methods.
    • Configure all Smart PDF Viewer properties directly as component attributes
  • MANDATORY: Before generating ANY code, verify that reference files exist and are accessible
  • Read the appropriate reference file(s) for the requested feature:
    • Use
      read_file
      tool on relevant
      references/*.md
      files
    • Confirm file contains Methods/Properties/Events tables
    • Verify tables are complete and readable
  • If reference file is missing or cannot be read:
    • STOP code generation
    • Respond: "Reference file for this feature is not available. Please ensure all reference files are present in the
      references/
      directory."
    • List the missing reference file name
  • This is a BLOCKER step: Cannot proceed without reference file validation
  • If an API/property does NOT appear in the reference file table, DO NOT USE IT
  • Do NOT invent, guess, or suggest any API, method, property, class, or namespace not explicitly present in the reference files
  • 生成前: 确认步骤1已完成
  • 读取与请求功能相关的
    references/*.md
    文件
  • 将每个API、属性和方法与这些表格交叉核对
  • 仅声明式方法(必填——禁止生命周期方法):
    • 仅在Razor标记中使用属性绑定,类似生命周期方法。
    • 直接将所有Smart PDF Viewer属性配置为组件属性
  • 必填: 在生成任何代码前,确认参考文件存在且可访问
  • 读取与请求功能相关的参考文件:
    • 对相关的
      references/*.md
      文件使用
      read_file
      工具
    • 确认文件包含方法/属性/事件表
    • 验证表格完整且可读
  • 如果参考文件缺失或无法读取:
    • 停止代码生成
    • 回复: "Reference file for this feature is not available. Please ensure all reference files are present in the
      references/
      directory."
    • 列出缺失的参考文件名
  • 这是一个阻塞步骤: 未验证参考文件则无法继续
  • 如果API/属性未出现在参考文件表格中,不得使用
  • 不得发明、猜测或建议任何未在参考文件中明确列出的API、方法、属性、类或命名空间

Code References

代码参考

All templates and operation snippets live in
references/*.md
. Each file is a focused snippet or template the agent will combine when generating samples.
FilePurpose
getting-started.mdFoundation setup and minimal Smart PDF Viewer component. Includes NuGet package installation, service registration, Azure OpenAI configuration, and complete setup prerequisites.
smart-redaction.mdAI-powered smart redaction configuration. Covers enabling/disabling redaction, custom redaction patterns (Person Names, Email Addresses, Phone Numbers, Credit Card Numbers, etc.), and default pattern definitions.
smart-fill.mdSmart form filling configuration. Documents the SmartFillSettings class for AI-powered automatic PDF form field population, enable/disable controls, and integration guidelines.
document-summarizer.mdDocument summarization and AI assistant configuration. Includes AssistViewSettings parameters like ShowPromptSuggestions, Prompt binding, PromptChanged callbacks, Placeholder, MinLength, and StreamResponse for real-time AI responses.
custom-ai-service.mdCustom AI service integration guide. Covers IChatInferenceService interface implementation, service registration in Program.cs, error handling with ErrorDialogService, and custom chat client integration patterns.
所有模板和操作代码片段都存储在
references/*.md
中。代理生成示例时会组合这些专注的代码片段或模板。
文件用途
getting-started.md基础设置和极简Smart PDF Viewer组件。包括NuGet包安装、服务注册、Azure OpenAI配置以及完整的设置前提条件。
smart-redaction.mdAI驱动的智能脱敏配置。涵盖启用/禁用脱敏、自定义脱敏模式(人名、电子邮件地址、电话号码、信用卡号等)以及默认模式定义。
smart-fill.md智能表单填写配置。记录用于AI驱动的PDF表单字段自动填充的SmartFillSettings类、启用/禁用控件以及集成指南。
document-summarizer.md文档摘要和AI助手配置。包括AssistViewSettings参数,如ShowPromptSuggestions、Prompt绑定、PromptChanged回调、Placeholder、MinLength和用于实时AI响应的StreamResponse。
custom-ai-service.md自定义AI服务集成指南。涵盖IChatInferenceService接口实现、Program.cs中的服务注册、ErrorDialogService错误处理以及自定义聊天客户端集成模式。

Quick Start Example

快速开始示例

razor
@rendermode InteractiveServer
Add component:
razor
<SfSmartPdfViewer Height="100%" Width="100%" DocumentPath="@DocumentPath">
</SfSmartPdfViewer>

razor
@rendermode InteractiveServer
添加组件:
razor
<SfSmartPdfViewer Height="100%" Width="100%" DocumentPath="@DocumentPath">
</SfSmartPdfViewer>