181 lines
4.4 KiB
Markdown
181 lines
4.4 KiB
Markdown
# PDFGeneratorLetteraBenvenuto Documentation
|
|
|
|
## Overview
|
|
|
|
PDFGeneratorLetteraBenvenuto is a specialized component for generating various types of client communication letters in PDF format. It provides a flexible and configurable system for creating personalized letters for different business scenarios.
|
|
|
|
## Architecture
|
|
|
|
### Base Class
|
|
|
|
#### LetteraBenvenuto
|
|
|
|
- Core class for letter generation
|
|
- Manages common letter elements:
|
|
- Client data (name, surname, address)
|
|
- Header
|
|
- Letter body
|
|
- Signature
|
|
- Greetings
|
|
|
|
### Letter Types
|
|
|
|
1. **LetteraAccettazioneConAttivazioneSei**
|
|
- Purpose: SEI service activation acceptance letter
|
|
- Features:
|
|
- Location-based customization (e.g., "Milano, [date]" for network "W")
|
|
- Custom signature positioning
|
|
- Configurable layout
|
|
|
|
2. **LetteraAccompagnamentoPeriodico**
|
|
- Purpose: Periodic report accompanying letter
|
|
- Features:
|
|
- Custom Y-axis bonus for greetings and signature
|
|
- Periodic report specific formatting
|
|
- Network-specific configurations
|
|
|
|
3. **LetteraCommerciale**
|
|
- Purpose: Commercial communications
|
|
- Features:
|
|
- Page numbering support
|
|
- Custom formatting for commercial content
|
|
- Flexible layout options
|
|
|
|
4. **LetteraRistampa**
|
|
- Purpose: Letter reprint management
|
|
- Features:
|
|
- Specific offset configurations
|
|
- Custom layout adjustments
|
|
- Height and width customization
|
|
|
|
## Technical Implementation
|
|
|
|
### PDF Generation
|
|
|
|
- Uses `ceTe.DynamicPDF` library
|
|
- Components:
|
|
- Page Elements
|
|
- PDF Merger
|
|
- Text formatting
|
|
|
|
### Configuration
|
|
|
|
- Managed through `ConfigurationManager.AppSettings`
|
|
- Configurable elements:
|
|
- Font sizes
|
|
- Offset positions
|
|
- Template paths
|
|
- Color schemes
|
|
|
|
### Template System
|
|
|
|
- Manages multiple template types:
|
|
- Report templates
|
|
- Cover page templates
|
|
- Glossary templates
|
|
- Welcome letter templates
|
|
- Customizable properties:
|
|
- Font colors
|
|
- Chapter backgrounds
|
|
- Table headers
|
|
- Text formatting
|
|
|
|
### Localization
|
|
|
|
- Supports Italian culture settings
|
|
- Date formatting using `CultureInfo`
|
|
- Network-specific text customization
|
|
|
|
## Data Sources
|
|
|
|
### Database (SqlServerStampeC6)
|
|
|
|
1. **Main Stored Procedures**:
|
|
- `[C6MartPeriodico].[GESTIONE_SELECT_LETTERE_DA_INVIARE]` - periodic letters
|
|
- `[C6Mart].[GESTIONE_SELECT_LETTERE_DA_INVIARE]` - standard letters
|
|
- `dbo.GetPDFTemplateConfiguration_Rosaspina` - template configurations
|
|
|
|
2. **Letter Input Parameters**:
|
|
- Network (Rete)
|
|
- ID
|
|
- Client Name and Surname
|
|
- Address
|
|
- Title/Form of Address
|
|
- Subject
|
|
- Signature
|
|
- Contract Type
|
|
|
|
3. **Configuration (App.config)**:
|
|
- Database connection string
|
|
- Formatting parameters
|
|
- Offset and positioning settings
|
|
|
|
### GestoreLettera Component
|
|
|
|
Manages data retrieval and processing:
|
|
|
|
- Database interaction
|
|
- Error handling
|
|
- Logging
|
|
- Letter type-specific queries
|
|
|
|
## Data Flow
|
|
|
|
1. Letter generation request with base parameters
|
|
2. `GestoreLettera` retrieves specific data from database
|
|
3. Template configuration retrieval via `GetPDFTemplateConfiguration_Rosaspina`
|
|
4. Data application to appropriate template
|
|
5. Custom formatting and positioning
|
|
6. PDF generation and output
|
|
|
|
## Configuration Parameters
|
|
|
|
Key configuration settings:
|
|
|
|
- `fontSize`: Font size for text elements
|
|
- `OffsetFirmaAttivazioneSei`: Signature positioning for SEI activation
|
|
- `OffSetLetteraRistampaCliente`: Client info positioning for reprints
|
|
- `OffsetLetteraRistampaSaluti`: Greeting positioning for reprints
|
|
|
|
## Integration Points
|
|
|
|
1. **Database**
|
|
- Uses `DataAccessDE` with `DBProvider.SqlServerStampeC6`
|
|
- Template configuration retrieval
|
|
- Client data access
|
|
|
|
2. **File System**
|
|
- Template file storage
|
|
- Generated PDF output
|
|
- Configuration files
|
|
|
|
## Best Practices
|
|
|
|
1. **Template Management**
|
|
- Keep templates in designated folders
|
|
- Use consistent naming conventions
|
|
- Maintain version control
|
|
|
|
2. **Configuration**
|
|
- Document all configuration parameters
|
|
- Test layout changes in all letter types
|
|
- Validate offset values
|
|
|
|
3. **Error Handling**
|
|
- Validate all input parameters
|
|
- Handle missing templates gracefully
|
|
- Log generation errors
|
|
|
|
## Future Considerations
|
|
|
|
1. **Enhancement Opportunities**
|
|
- Additional letter types
|
|
- Enhanced template customization
|
|
- Improved error handling
|
|
- Performance optimization
|
|
|
|
2. **Maintenance**
|
|
- Regular template updates
|
|
- Configuration review
|
|
- Performance monitoring
|