Skip to content

PDFCLOUD-5217 Make the C# examples runnable (part 2, with sensitive file deletion merged in)#110

Closed
datalogics-kam wants to merge 33 commits into
pdfrest:mainfrom
datalogics-kam:pdfcloud-5217-runnable-csharp-samples
Closed

PDFCLOUD-5217 Make the C# examples runnable (part 2, with sensitive file deletion merged in)#110
datalogics-kam wants to merge 33 commits into
pdfrest:mainfrom
datalogics-kam:pdfcloud-5217-runnable-csharp-samples

Conversation

@datalogics-kam

@datalogics-kam datalogics-kam commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

Please review/merge #104 first

If the C# changes without the sensitive file delete are desired, merge #113

* Complex flow examples: redact-preview-and-finalize
* /pdf-with-redacted-text-preview
* /pdf-with-redacted-text-applied
* Complex flow examples: protected-watermark
* /watermarked-pdf-image
* /watermarked-pdf
* Complex flow examples: decrypt-add-reencrypt
* /encrypted-pdf
* /encrypted-pdf-new-password
* /encrypted-pdf-change-password
* /decrypted-pdf - deletes the decrypted outputs
* /decrypted-pdf-with-permissions-password - deletes the decrypted outputs
* /restricted-pdf
* /restricted-pdf-change-password
* /restricted-pdf-add-password-with-open-password
* /restricted-pdf-add-password-and-restrictions
* /unrestricted-pdf
* /unrestricted-pdf-with-open-password
* pdf-with-redacted-text-preview
* pdf-with-redacted-text-applied
* watermarked-pdf
* encrypted-pdf
* decrypted-pdf
* restricted-pdf
* unrestricted-pdf
* Work done by Codex
* Adds optional delete step to the above samples in all languages (besides cURL) with relevant comment.
* For unrestricted or decrypted-pdf, delete the outputId. Otherwise, delete the inputId.
* For pdf-with-redacted-text-preview samples, delete both the inputId and outputId as they are both unredacted, but add a warning comment.
* Fixes PDFWithRedactedTextPreview.java with missing bracket
* Fixes remaining java samples with `mvn spotless:apply`
* Wrap whole delete block in parent if so that all variables are in scope
* Watermarking with text returns an inputId that is an array of 1 string id.
@datalogics-kam datalogics-kam force-pushed the pdfcloud-5217-runnable-csharp-samples branch from ff90d69 to 17cb74f Compare September 4, 2025 23:53
@datalogics-kam datalogics-kam marked this pull request as ready for review September 4, 2025 23:53
@datalogics-kam datalogics-kam marked this pull request as draft September 4, 2025 23:55
- Refined instructions for setting up and running samples with a .NET 8 dispatcher.
- Added `.env.example` usage and environment configuration tips for API keys and GDPR compliance.
- Updated coding conventions, testing guidelines, and sample adaptation steps.
- Enhanced headers to standardize example descriptions and setup details.
- Added `DotNetSamples.csproj` with a minimal dispatcher (`Program.cs`) for routing commands.
- Implemented `markdown-json` example: two-step upload and JSON-based Markdown conversion.
- Introduced `.env.example` for API key configuration and optional EU/GDPR endpoint setup.
- Updated `AGENTS.md` with setup, usage instructions, rationale for project structure, and coding conventions.
- Organized examples into `namespace Samples.EndpointExamples.JsonPayload` for logical grouping.
- Replaced hardcoded API keys and URLs with environment variables for enhanced security and configurability.
- Introduced input validation and error handling for required parameters and files.
- Standardized execution methods in all examples, aligning with updated coding conventions.
- Documented purpose, setup, usage, and output for each sample.
- Aligned all examples with established header format for consistency.
- Included GDPR compliance API call details and environment variable instructions.
… handling

- Added headers to new examples, documenting purpose, setup, usage, and output.
- Replaced hardcoded file paths, API keys, and URLs with environment variables.
- Enhanced input validation, error handling, and exception messages across samples.
- Updated `merge-different-file-types` and `pdf-multipart` examples for clarity and alignment with guidelines.
…proved error handling

- Introduced multipart handling for multiple formats: PNG, JPG, GIF, BMP, TIF, and Office files.
- Enhanced headers to include purpose, setup, usage, and GDPR API details.
- Standardized input validation, environment variable usage, and API key handling.
- Updated `Program.cs` to route new multipart commands.
- Expanded `Program.cs` to route new multipart payload commands.
- Implemented examples for multipart operations: encryption, decryption, text addition, image embedding, and more.
- Enhanced error handling, input validation, and logging for multipart samples.
- Updated `DotNetSamples.csproj` to include newly added multipart-specific implementations.
- Added detailed usage instructions, setup steps, and expected output headers to all multipart payload examples.
- Enhanced consistency by aligning with standardized header format.
- Included additional environment variable handling and GDPR API call details.
- Added detailed headers documenting the purpose, setup, usage, and output for complex flow examples.
- Refactored to use environment variables for API keys, URLs, and input paths.
- Enhanced input validation, error handling, and logging across all examples.
- Simplified repetitive code by introducing clearer patterns for request creation and execution.
- Implemented `exported-form-data.cs` under JSON payload examples for two-step upload and form data export.
- Enhanced headers with purpose, setup, usage, and output details for consistency.
- Added routing to `Program.cs` and updated dispatcher for new command.
- Enabled compilation in `DotNetSamples.csproj` by including new example.
- Improved input validation, error handling, and environment variable usage for secure API integration.
- Added multiple new command usage examples to AGENTS.md for improved clarity and reference.
- Refined explanations for sample adaptation steps, emphasizing header placement and formatting.
- Enhanced consistency and alignment with established documentation standards.
…, and examples

- Introduced a detailed README for .NET 8 C# pdfRest API samples covering setup, build, and usage instructions.
- Documented various sample categories: JSON payload, multipart payload, and complex workflows.
- Included regional API setup, environment variable usage, and handy runner scripts for enhanced usability.
- Provided example commands, output descriptions, and verification steps for end-users.
- Ensured alignment with standardized documentation practices for clarity and consistency.
@datalogics-kam datalogics-kam force-pushed the pdfcloud-5217-runnable-csharp-samples branch from 17cb74f to e09c739 Compare September 5, 2025 14:51
datalogics-dliang and others added 6 commits September 5, 2025 09:55
* Add a toggle to turn the deletion step on or off with the PDFREST_DELETE_SENSITIVE_FILES variable.
* Use PDFREST_DELETE_SENSITIVE_FILES=true to turn on the deletion step.
* Update global README.md and cURL README.md to explain this logic
* Make the delete step optional by adding a local variable which the user can toggle on/off to do the delete step.
* The delete step is off by default.
* Match the rest of the samples and use DELETE_SENSITIVE_FILES.
…sharp-samples

* security-optional-delete:
  Format Java samples
  Standardize variable naming in cURL
  Make delete step optional with local toggle
  cURL: Make deletion step toggleable
  Fix watermark samples for other languages
  Correct basic watermark sample
  Correct complex watermark example
  Correct typos and make headers consistent
  Fix jq syntax errors in cURL
  PDFWithRedactedTextPreview.java: fix formatting
  Update PDFWithRedactedTextPreview.java
  Run `mvn spotless:apply` to Java JSON samples
  Add optional delete step to base security samples
  cURL: Add delete step to restrict endpoints
  cURL: Add delete step to encrypt endpoints
  cURL: Add delete step to watermark endpoints
  cURL: Add delete step to redact endpoints
…ETE_SENSITIVE_FILES` environment variable

- Updated `.env.example` with the new optional toggle.
- Revised README to document the feature and its usage.
- Refactored all C# JSON and multipart payload examples to use the environment variable for toggleable deletion.
- Simplified deletion logic with default behavior and enhanced clarity.
- Enhanced application usage documentation in `Program.cs` to include the new environment variable details.
@datalogics-kam datalogics-kam marked this pull request as ready for review September 5, 2025 20:15
@datalogics-kam datalogics-kam changed the title PDFCLOUD-5217 Make the C# examples runnable PDFCLOUD-5217 Make the C# examples runnable (part 2, with sensitive file deletion merged in) Sep 5, 2025
@datalogics-kam datalogics-kam deleted the pdfcloud-5217-runnable-csharp-samples branch September 15, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants