syncfusion-winforms-pdf-viewer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSyncfusion WinForms PdfViewer - UI Sample generator
Syncfusion WinForms PdfViewer - UI示例生成器
Generate C# Code for the User's Project (default)
为用户项目生成C#代码(默认功能)
Trigger keywords: "code", "snippet", "how to write", "Program.cs", "show me", "sample", "integrate", "example code", "generate code for", "create sample", "winforms pdfviewer".
Purpose: Generate clean, ready-to-use C# code snippets that directly insert into their WinForms application when working with Syncfusion WinForms PdfViewer control.
Workflow:
- Build the C# code using the snippets provided in the references/*.md files.
- Before generating the sample, ask the user whether the code should be:Integrated into an existing WinForms project, or Created as a new WinForms application.
- If the user chooses to create a new WinForms project, ask them which target framework they want to use: -.NET Framework (e.g., 4.6, 4.7, 4.8) — uses Syncfusion.PdfViewer.WinForms and targets the classic .NET Framework. -.NET / .NET Core (e.g., .NET 8, .NET 10) — uses Syncfusion.PdfViewer.WinForms with <TargetFramework>net8.0-windows</TargetFramework> (or the selected version).
- Based on the user's choice: Generate the .csproj file with the correct <TargetFramework> value. Add the required NuGet packages. Tailor any framework-specific code, such as namespace imports, form initialization, startup code (Program.cs), and PDF Viewer setup, accordingly.
- Add only the APIs required to satisfy the user's requested functionality. Do not include optional APIs, additional.
触发关键词: "code", "snippet", "how to write", "Program.cs", "show me", "sample", "integrate", "example code", "generate code for", "create sample", "winforms pdfviewer"
用途: 生成简洁、可直接使用的C#代码片段,可直接插入到使用Syncfusion WinForms PdfViewer控件的WinForms应用程序中。
工作流程:
- 使用references/*.md文件中提供的代码片段构建C#代码。
- 在生成示例前,询问用户代码应:集成到现有WinForms项目中,还是创建为新的WinForms应用程序。
- 如果用户选择创建新的WinForms项目,询问他们想要使用哪个目标框架: -.NET Framework(例如4.6、4.7、4.8)——使用Syncfusion.PdfViewer.WinForms,面向经典.NET Framework。 -.NET / .NET Core(例如.NET 8、.NET 10)——使用Syncfusion.PdfViewer.WinForms,并设置<TargetFramework>net8.0-windows</TargetFramework>(或所选版本)。
- 根据用户的选择: 生成带有正确<TargetFramework>值的.csproj文件。 添加所需的NuGet包。 调整任何框架特定代码,例如命名空间导入、窗体初始化、启动代码(Program.cs)和PDF Viewer设置。
- 仅添加满足用户请求功能所需的API。不要包含可选API或额外内容。
Code References
代码参考
All templates and snippets are in the folder. Each file is a focused snippet or template the agent will combine when generating sample:
references/| File | Contents |
|---|---|
| view-pdfviewer.md | NuGet setup, add PdfViewerControl/PdfDocumentView, load PDF |
| saving-pdf-files.md | Save PDF via toolbar, programmatic save using |
| printing-pdf-files.md | Print PDF via toolbar, silent printing using |
| extract-text.md | Extract text from a single page using |
| pdf-rendering-engines.md | Switch rendering engine using |
| searching-text.md | Search next/previous text instance using |
| navigation.md | Bookmark navigation, hyperlink handling, and page navigation (programmatic |
| localization.md | Localize tooltip and context menu static text, default |
| themes.md | Apply built-in themes using |
| interaction-modes.md | Switch cursor modes using |
| error-handling.md | Subscribe to |
| magnifying.md | Zoom to a specific percentage using |
| view-pdf-stream.md | Load a PDF from a |
| document-information.md | Access filename and file path of the loaded PDF via |
| mouse-position.md | Handle |
| host-wpf-pdfviewer-in-winforms.md | Host the WPF PdfViewer inside a WinForms app using |
| toolbar.md | Show/hide individual toolbar buttons (Open, Save, Zoom, Print, Pan) using |
所有模板和代码片段都位于文件夹中。每个文件都是一个聚焦的代码片段或模板,代理将在生成示例时组合使用:
references/| 文件 | 内容 |
|---|---|
| view-pdfviewer.md | NuGet设置、添加PdfViewerControl/PdfDocumentView、加载PDF |
| saving-pdf-files.md | 通过工具栏保存PDF、使用 |
| printing-pdf-files.md | 通过工具栏打印PDF、使用 |
| extract-text.md | 使用 |
| pdf-rendering-engines.md | 使用 |
| searching-text.md | 使用 |
| navigation.md | 书签导航、超链接处理和页面导航(编程方式 |
| localization.md | 本地化工具提示和上下文菜单静态文本、默认 |
| themes.md | 使用 |
| interaction-modes.md | 使用 |
| error-handling.md | 订阅 |
| magnifying.md | 使用 |
| view-pdf-stream.md | 使用 |
| document-information.md | 通过 |
| mouse-position.md | 处理 |
| host-wpf-pdfviewer-in-winforms.md | 使用 |
| toolbar.md | 使用 |
Prerequisites
前提条件
- Development Environment:Visual Studio 2022 or Visual Studio insider 2026(recommended for .NET 10).
- .NET Framework 4.5+ or .NET Core/NET 8+
- Syncfusion WinForms NuGet Package: Syncfusion.PdfViewer.Windows
- 开发环境:Visual Studio 2022或Visual Studio Insider 2026(推荐用于.NET 10)。
- .NET Framework 4.5+或.NET Core/.NET 8+
- Syncfusion WinForms NuGet包:Syncfusion.PdfViewer.Windows