Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

File Converters

File converters transform text into file outputs such as PDFs. These converters are useful for packaging prompts into distributable formats.

Overview

This notebook covers:

  • PDFConverter: Convert text to PDF documents with templates or direct generation

  • WordDocConverter: Convert text to Word (.docx) documents with optional placeholder injection

PDFConverter

The PDFConverter generates PDF documents from text in multiple modes:

  1. Template-Based PDF Generation: Use YAML templates to render dynamic content into PDFs

  2. Direct Prompt PDF Generation: Convert plain text strings into PDFs without templates

  3. Modify Existing PDFs: Inject text into existing PDF documents

Template-Based PDF Generation

This mode populates placeholders in a YAML-based template and converts the rendered content into a PDF.

Found default environment files: ['./.pyrit/.env', './.pyrit/.env.local']
Loaded environment file: ./.pyrit/.env
Loaded environment file: ./.pyrit/.env.local
No new upgrade operations detected.
TextTarget: user: ./dbdata/prompt-memory-entries/binaries/1779402999644083.pdf

════════════════════════════════════════════════════════════════════════════════════════════════════
                                  ❓ ATTACK RESULT: UNDETERMINED ❓                                   
════════════════════════════════════════════════════════════════════════════════════════════════════

 Attack Summary 
────────────────────────────────────────────────────────────────────────────────────────────────────
  📋 Basic Information
    • Objective: {'hiring_manager_name': 'Jane Doe', 'current_role': 'AI Engineer', 'company': 'CyberDefense Inc.', 'red_teaming_reason': 'to creatively identify security vulnerabilities while enjoying free coffee', 'applicant_name': 'John Smith'}
    • Attack Type: PromptSendingAttack
    • Conversation ID: 9edbd5d0-2bde-4432-b4a7-91b9688f4377

  ⚡ Execution Metrics
    • Turns Executed: 1
    • Execution Time: 45ms

  🎯 Outcome
    • Status: ❓ UNDETERMINED
    • Reason: No objective scorer configured

 Conversation History with Objective Target 
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
🔹 Turn 1 - USER
────────────────────────────────────────────────────────────────────────────────────────────────────
   Original:
  {'hiring_manager_name': 'Jane Doe', 'current_role': 'AI Engineer', 'company': 'CyberDefense Inc.',
      'red_teaming_reason': 'to creatively identify security vulnerabilities while enjoying free
      coffee', 'applicant_name': 'John Smith'}

   Converted:
  ./dbdata/prompt-
      memory-entries\binaries\1779402999644083.pdf

────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
                            Report generated at: 2026-05-21 22:36:39 UTC                            

Direct Prompt PDF Generation (No Template)

This mode converts plain text strings directly into PDFs without using templates.

TextTarget: user: ./dbdata/prompt-memory-entries/binaries/1779402999698469.pdf

════════════════════════════════════════════════════════════════════════════════════════════════════
                                  ❓ ATTACK RESULT: UNDETERMINED ❓                                   
════════════════════════════════════════════════════════════════════════════════════════════════════

 Attack Summary 
────────────────────────────────────────────────────────────────────────────────────────────────────
  📋 Basic Information
    • Objective: This is a simple test string for PDF generation. No templates here!
    • Attack Type: PromptSendingAttack
    • Conversation ID: 3d86d651-30f2-4d2d-8585-a130ba3dc077

  ⚡ Execution Metrics
    • Turns Executed: 1
    • Execution Time: 23ms

  🎯 Outcome
    • Status: ❓ UNDETERMINED
    • Reason: No objective scorer configured

 Conversation History with Objective Target 
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
🔹 Turn 1 - USER
────────────────────────────────────────────────────────────────────────────────────────────────────
   Original:
  This is a simple test string for PDF generation. No templates here!

   Converted:
  ./dbdata/prompt-
      memory-entries\binaries\1779402999698469.pdf

────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
                            Report generated at: 2026-05-21 22:36:39 UTC                            

Modifying Existing PDFs with Injection Items

The PDFConverter can also inject text into existing PDF documents at specified locations.

[15:36:40][10][ai-red-team][INFO][Processing page 0 with 2 injection items.]
[15:36:40][13][ai-red-team][INFO][Processing page 1 with 2 injection items.]
[15:36:40][15][ai-red-team][INFO][Processing page 2 with 2 injection items.]
TextTarget: user: ./dbdata/prompt-memory-entries/binaries/1779403000017242.pdf

════════════════════════════════════════════════════════════════════════════════════════════════════
                                  ❓ ATTACK RESULT: UNDETERMINED ❓                                   
════════════════════════════════════════════════════════════════════════════════════════════════════

 Attack Summary 
────────────────────────────────────────────────────────────────────────────────────────────────────
  📋 Basic Information
    • Objective: Modify existing PDF
    • Attack Type: PromptSendingAttack
    • Conversation ID: 7f9101d9-93b6-49e3-88ae-1bebaf44a0af

  ⚡ Execution Metrics
    • Turns Executed: 1
    • Execution Time: 31ms

  🎯 Outcome
    • Status: ❓ UNDETERMINED
    • Reason: No objective scorer configured

 Conversation History with Objective Target 
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
🔹 Turn 1 - USER
────────────────────────────────────────────────────────────────────────────────────────────────────
   Original:
  Modify existing PDF

   Converted:
  ./dbdata/prompt-
      memory-entries\binaries\1779403000017242.pdf

────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
                            Report generated at: 2026-05-21 22:36:40 UTC                            

WordDocConverter

The WordDocConverter generates Word (.docx) documents from text. It supports two main modes:

  1. New Document Generation: Convert plain text strings into Word documents

  2. Placeholder-Based Injection: Replace a placeholder in an existing .docx document with rendered content

Placeholders must be fully contained within a single run in the document. If a placeholder spans multiple runs (e.g., due to mixed formatting), it will not be replaced.

Direct Word Document Generation (No Template)

This mode converts plain text strings directly into .docx files.

TextTarget: user: ./dbdata/prompt-memory-entries/binaries/1779403000064406.docx

════════════════════════════════════════════════════════════════════════════════════════════════════
                                  ❓ ATTACK RESULT: UNDETERMINED ❓                                   
════════════════════════════════════════════════════════════════════════════════════════════════════

 Attack Summary 
────────────────────────────────────────────────────────────────────────────────────────────────────
  📋 Basic Information
    • Objective: This is a simple test string for Word document generation.
    • Attack Type: PromptSendingAttack
    • Conversation ID: 172b3107-93fa-4443-b155-3d94f41e79ea

  ⚡ Execution Metrics
    • Turns Executed: 1
    • Execution Time: 38ms

  🎯 Outcome
    • Status: ❓ UNDETERMINED
    • Reason: No objective scorer configured

 Conversation History with Objective Target 
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
🔹 Turn 1 - USER
────────────────────────────────────────────────────────────────────────────────────────────────────
   Original:
  This is a simple test string for Word document generation.

   Converted:
  ./dbdata/prompt-
      memory-entries\binaries\1779403000064406.docx

────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
                            Report generated at: 2026-05-21 22:36:40 UTC                            

Placeholder-Based Injection into Existing Word Documents

This mode replaces a literal placeholder string in an existing .docx file with the prompt content.

TextTarget: user: ./dbdata/prompt-memory-entries/binaries/1779403000154543.docx

════════════════════════════════════════════════════════════════════════════════════════════════════
                                  ❓ ATTACK RESULT: UNDETERMINED ❓                                   
════════════════════════════════════════════════════════════════════════════════════════════════════

 Attack Summary 
────────────────────────────────────────────────────────────────────────────────────────────────────
  📋 Basic Information
    • Objective: AI Red Team Engineer
    • Attack Type: PromptSendingAttack
    • Conversation ID: f68f05e7-bb47-4a9d-93b1-aae35b0ba497

  ⚡ Execution Metrics
    • Turns Executed: 1
    • Execution Time: 54ms

  🎯 Outcome
    • Status: ❓ UNDETERMINED
    • Reason: No objective scorer configured

 Conversation History with Objective Target 
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
🔹 Turn 1 - USER
────────────────────────────────────────────────────────────────────────────────────────────────────
   Original:
  AI Red Team Engineer

   Converted:
  ./dbdata/prompt-
      memory-entries\binaries\1779403000154543.docx

────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
                            Report generated at: 2026-05-21 22:36:40 UTC