Overview
Once an inspection form is completed, you can generate a professional PDF report that includes all form data, photos, signatures, and deficiency tracking. The system supports both individual form PDFs and merged complete inspection reports.Understanding PDF Types
The system generates different types of PDFs depending on the form:Main Inspection PDF (Merged Report)
When you generate the main inspection form PDF, the system creates a complete report that includes:- Main inspection form with all data
- Embedded photos with context
- Technician and client signatures
- Deficiencies summary
- Additional risers (if any)
- Corrected deficiencies (if applicable)
The main form is determined by matching the inspection’s
form_template_id (see form_fill.rb:942-945).Individual Form PDF
For supplemental forms (Additional Risers, Corrected Deficiencies), you can generate standalone PDFs (seeform_fills_controller.rb:589-604).
Generate a PDF Report
Complete the Form
Ensure all required fields are filled, including:
- Inspection data (pass/fail/n/a selections)
- Photos of equipment and deficiencies
- Technician signature
- Client signature
Submit the Form
Click Submit Form on the form fill page. This triggers the PDF generation process.
For main forms, this calls
generate_main_pdf_with_merge (see form_fills_controller.rb:607-621). For individual forms, it calls generate_individual_pdf (see form_fills_controller.rb:589-604).Wait for Generation
The system displays a message: “Your PDF is being generated and will be available shortly.”PDF generation happens in the background via job queue:
- Main PDFs:
GeneratePdfJob(seeform_fills_controller.rb:618) - Individual PDFs:
GenerateIndividualPdfJob(seeform_fills_controller.rb:601)
The form’s
pdf_generation_status is set to “generating” to prevent duplicate generation requests (see form_fill.rb:8-13 and form_fills_controller.rb:598).Download PDF Reports
Choose View Option
- View in Browser: Opens the PDF in a new tab (inline disposition)
- Download to Device: Saves the file to your downloads folder
The download endpoint supports both inline viewing and attachment download (see
form_fills_controller.rb:628-643).PDF Generation Process Details
Understanding what happens behind the scenes:Data Merging
The system merges form structure with saved data to create the complete dataset for PDF generation (seeform_fill.rb:896-926):
- Loads form structure (field definitions)
- Retrieves data values from the
datacolumn (seeform_fill.rb:776-783) - Merges structure and data into a unified format
- Adds photos with context (section names, labels) (see
form_fill.rb:1013-1056) - Includes signatures for technician and client
Photo Inclusion
Photos are organized by field and section for the PDF (seeform_fill.rb:1013-1056 and form_fill.rb:428-465):
- Photos are grouped by field name
- Each photo includes section name and label for context
- Multiple photos per field are supported
Deficiency Processing
Deficiencies are extracted and formatted for the report (seeform_fill.rb:953-1011):
- All “Fail” items are collected
- Deficiency collections are parsed (see
form_fill.rb:966-986) - Critical and documented flags are included
- Item and riser details are preserved
The merged data is available via the
get_merged_form_data endpoint for PDF generation services (see form_fills_controller.rb:500-519).Email Reports to Customers
Send completed reports directly to customers via email.Ensure PDF is Generated
The PDF must be generated before sending. Check for the Download PDF button.
Review Email Details
The email form includes:
- Recipient: Customer email (auto-filled from property record)
- Subject: Default subject line (customizable)
- Body: Email message (customizable)
- Attachment: PDF report (automatically attached)
The recipient email is pulled from the property’s customer record. Make sure customer contact information is up to date.
Email Error Handling
The system provides detailed error messages for common issues (seeform_fills_controller.rb:662-678):
| Error | Meaning | Resolution |
|---|---|---|
| PDF not available | PDF hasn’t been generated | Generate PDF first, then try sending |
| Customer email missing | No email on customer record | Update customer information with valid email |
| Invalid email format | Email address format is incorrect | Correct the email address in customer record |
| Attachment too large | PDF file exceeds size limit | Contact administrator to adjust limits |
| SMTP connection failed | Email service unavailable | Check internet connection and SMTP settings |
| SMTP authentication failed | Email credentials incorrect | Contact administrator to verify SMTP config |
Regenerate PDFs
If you need to regenerate a PDF after making changes:Check PDF Status
You can check if a form has a PDF and its generation status:- pdf_created: Boolean indicating if a PDF exists (see
form_fill.rb:938-940) - pdf_generation_status: Current status (ready/generating/completed/failed) (see
form_fill.rb:8-13) - last_generated_at: Timestamp of most recent generation
You can query these fields to determine if a form fill has an individual PDF (see
form_fill.rb:938-940).Main Form Merge Logic
When generating the main inspection PDF, the system determines which additional forms to include (seeform_fill.rb:948-950):
- Main form: Always included (based on inspection’s template)
- Additional forms: Included only if they have PDFs generated (
pdf_created == true) - Exclude: The main form itself from the merge list
Best Practices
Troubleshooting
PDF Generation Stuck on “Generating”
- Check the background job queue status
- Refresh the page after a few minutes
- Contact administrator if it remains stuck for over 10 minutes
PDF Missing Data or Photos
- Verify all data is saved in the form (check the form fill detail page)
- Ensure photos are fully uploaded before generating
- Check that the template structure matches the data (see
form_fill.rb:896-926) - Regenerate the PDF
Email Not Sending
- Verify customer has a valid email address
- Check SMTP configuration with administrator
- Ensure PDF is under the maximum attachment size
- Review error message for specific issue (see
form_fills_controller.rb:662-678)
Wrong Template Used
- Check the inspection’s system and interval categories
- Verify the correct template is assigned to that combination
- Contact administrator to update template assignments
Next Steps
After generating and sending your report:- Mark the inspection as “Completed”
- Review deficiencies and schedule follow-up inspections if needed
- Archive the PDF for compliance and record-keeping
- Update property records with inspection completion date