Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6f4acbd
updated postman readme
isadoraPGoNitro Dec 10, 2025
90fefd8
first iteration on the prepare_pdf_for_distribution scrpt (removing p…
isadoraPGoNitro Dec 11, 2025
06cb904
added remotion of properties from pdf
isadoraPGoNitro Dec 11, 2025
d965240
fix deleting of properties
isadoraPGoNitro Dec 12, 2025
b8b66e4
updated pdf_for_distribution script and added new test documents
isadoraPGoNitro Dec 15, 2025
87f1778
updated pii-redaction script by: adding story telling and allowing ba…
isadoraPGoNitro Dec 15, 2025
d627f26
updated existing scripts
isadoraPGoNitro Dec 16, 2025
ffa6809
creation of sign workflow (status:working but needs cleanup
isadoraPGoNitro Dec 18, 2025
b454bb1
cleaned up onboarding script
isadoraPGoNitro Dec 19, 2025
5fc5975
fixes
isadoraPGoNitro Dec 22, 2025
8ab9290
Merge branch 'main' into PIGS-74_Workflow_examples
isadoraPGoNitro Dec 22, 2025
84d8dc8
updated code to use uv, fix ruff errors
isadoraPGoNitro Dec 23, 2025
9d80010
fix request calls to use httpx
isadoraPGoNitro Dec 23, 2025
be0cec0
fix pylint errors
isadoraPGoNitro Dec 30, 2025
8b88e63
updated documentation and taskfile
isadoraPGoNitro Dec 30, 2025
7a604e2
fixes to: use pydantic-settings for environment configuration,use typ…
isadoraPGoNitro Dec 31, 2025
89b1b17
updated scripts to use typer
isadoraPGoNitro Jan 4, 2026
bd69f4e
updated settings to be private, added reusable httpx.client, created …
isadoraPGoNitro Jan 4, 2026
402feb4
initial commit with script in typescript
isadoraPGoNitro Jan 5, 2026
593f2e6
Merge branch 'main' into PIGS-74_Workflow_Examples_TypeScript
isadoraPGoNitro Jan 6, 2026
4547d6b
updated typescript scripts
isadoraPGoNitro Jan 6, 2026
6ca6bba
Merge branch 'main' into PIGS-74_Workflow_Examples_TypeScript
isadoraPGoNitro Jan 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 154 additions & 1 deletion samples/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,163 @@ python convert_cli.py ../../test_files/test-batch/Analysis.docx /tmp/output.pdf
./test_all.sh
```

## Sample Files
## Testing with Sample Files

The repository includes test files you can use to try out the scripts. All test files are located in the `../../test_files/` directory (relative to the Python samples folder).

### Quick Test Commands

#### 1. Test Authentication
```bash
uv run python quickstart.py
# Expected: ✅ Authentication successful! Token: eyJ0...
```

#### 2. Convert Single Document
```bash
# Convert Word document to PDF
uv run python convert_cli.py ../../test_files/test-batch/Analysis.docx output/test_output.pdf pdf

# Convert Excel to PDF
uv run python convert_cli.py ../../test_files/test-batch/Feedback.xlsx output/test_output.pdf pdf

# Convert PowerPoint to PNG
uv run python convert_cli.py ../../test_files/SamplePPTX.pptx output/test_output.png png
```

#### 3. Batch Document Conversion
```bash
# Convert all Word documents in test-batch to PDF
uv run python batch_process.py \
../../test_files/test-batch \
output/batch_results \
pdf \
"*.docx"

# Convert all Excel files
uv run python batch_process.py \
../../test_files/test-batch \
output/batch_results \
pdf \
"*.xlsx"
```

#### 4. Extract Data from PDFs
```bash
# Extract form fields from student loan application
uv run python extract_data.py \
forms \
"../../test_files/test-pdfs/BOB - Student-Loan-Application-Form.pdf" \
output/forms_output.json

# Extract tables from PDF
uv run python extract_data.py \
tables \
"../../test_files/test-pdfs/Sample Tables.pdf" \
output/tables_output.json
```

#### 5. Smart PII Redaction
```bash
# Automatically detect and redact PII from PDFs
uv run python smart_redact_pii.py \
../../test_files/test-pdfs \
output/pii_redacted
```

#### 6. Keyword-Based Redaction
```bash
# Redact specific keywords from resume
uv run python redact_by_keyword.py \
../../test_files/test-pdfs/SampleResume.pdf \
output/redacted.pdf \
"resume" "contact"
```

#### 7. Bulk Password Protection
```bash
# Password protect all PDFs in test-pdfs folder
uv run python bulk_password_protect.py \
../../test_files/test-pdfs \
output/protected \
"SecurePass123"
```

#### 8. Prepare PDFs for Distribution
```bash
# Convert marketing brochures to optimized PDFs with metadata removed
uv run python prepare_pdf_for_distribution.py \
../../test_files/pdf-distribution \
output/distribution
```

#### 9. Employee Policy Onboarding (Sign API)
```bash
# Send company policies for signature to employees
uv run python employee_policy_onboarding.py \
../../test_files/test-sign \
../../test_files/test-sign/employees.csv

# Note: This sends real signature requests to email addresses in the CSV!
# Check the CSV file first: ../../test_files/test-sign/employees.csv
```

### Using Task Commands

All the above can also be run using Task commands for convenience:

```bash
# Convert
task convert INPUT=../../test_files/test-batch/Analysis.docx OUTPUT=output/test.pdf FORMAT=pdf

# Batch process
task batch INPUT_DIR=../../test_files/test-batch OUTPUT_DIR=output/batch FORMAT=pdf PATTERN='*.docx'

# Extract data
task extract MODE=tables INPUT="../../test_files/test-pdfs/Sample Tables.pdf" OUTPUT=output/tables.json

# Smart redact
task smart-redact INPUT_DIR=../../test_files/test-pdfs OUTPUT_DIR=output/redacted

# Prepare PDFs
task prepare-distribution INPUT_DIR=../../test_files/pdf-distribution OUTPUT_DIR=output/distribution

# Employee onboarding
task onboard-employees POLICIES_DIR=../../test_files/test-sign CSV=../../test_files/test-sign/employees.csv
```

### Available Test Files

Sample files for testing are available in the `test_files/` folder at the repository root.

#### Batch Conversion (`test_files/test-batch/`)
- `Analysis.docx` - Word document
- `Feedback.xlsx` - Excel spreadsheet

#### PDF Operations (`test_files/test-pdfs/`)
- `SampleResume.pdf` - Resume with PII (for redaction testing)
- `Sample Tables.pdf` - PDF with tables (for extraction)
- `BOB - Student-Loan-Application-Form.pdf` - Form with fields (for extraction)

#### Distribution (`test_files/pdf-distribution/`)
- `Marketing_Brochure_Product_A_Rich.docx`
- `Marketing_Brochure_Product_B_Rich.docx`
- `Marketing_Brochure_Product_C_Rich.docx`

#### Sign API (`test_files/test-sign/`)
- `company-policies.pdf` - Company policy document
- `confidentiality-agreement.pdf` - NDA template
- `sample-company-policies.pdf` - Additional policy
- `employees.csv` - Sample employee list for testing

### Important Notes

- **Sign API Testing**: The `employee_policy_onboarding` script sends real signature requests via email. Make sure the email addresses in `employees.csv` are valid and you have permission to send them test requests.
- **Output Folders**: All scripts automatically create output folders if they don't exist.
- **File Paths**: Use quotes around file paths with spaces (e.g., `"Sample Tables.pdf"`).
- **Large Files**: Some operations may take longer with large or complex documents.


## Getting Your Credentials

1. Go to [https://admin.gonitro.com](https://admin.gonitro.com)
Expand Down
3 changes: 3 additions & 0 deletions samples/typescript/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PLATFORM_BASE_URL=https://api.gonitro.dev
PLATFORM_CLIENT_ID=your-client-id-here
PLATFORM_CLIENT_SECRET=your-client-secret-here
30 changes: 30 additions & 0 deletions samples/typescript/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Dependencies
node_modules/

# Build outputs
dist/
*.tsbuildinfo

# Environment files
.env
.env.local

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Output files
output/
temp/
Loading