Soumik Bose commited on
Commit
a28f249
·
1 Parent(s): 58b47de
Files changed (1) hide show
  1. pdf_report_generation_service.py +70 -3
pdf_report_generation_service.py CHANGED
@@ -608,9 +608,6 @@ class Q4ReportGenerator:
608
  'guess_lang': False,
609
  'noclasses': True,
610
  'css_class': 'highlight'
611
- },
612
- 'md_in_html': {
613
- 'allowed_elements': ['div', 'blockquote', 'section', 'article', 'aside', 'span']
614
  }
615
  }
616
  )
@@ -708,3 +705,73 @@ class Q4ReportGenerator:
708
  logger.info("Cleaned up temporary images")
709
  except Exception as e:
710
  logger.warning(f"Failed to cleanup images: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
  'guess_lang': False,
609
  'noclasses': True,
610
  'css_class': 'highlight'
 
 
 
611
  }
612
  }
613
  )
 
705
  logger.info("Cleaned up temporary images")
706
  except Exception as e:
707
  logger.warning(f"Failed to cleanup images: {e}")
708
+
709
+
710
+ # ---------------------------------------------------------
711
+ # EXAMPLE USAGE
712
+ # ---------------------------------------------------------
713
+ if __name__ == "__main__":
714
+ # Example of how to use the generator
715
+ generator = Q4ReportGenerator(
716
+ title="Q4 2024 Performance Report",
717
+ subtitle="Executive Summary & Analysis",
718
+ author="Analytics Team",
719
+ department="Business Intelligence",
720
+ confidential=True
721
+ )
722
+
723
+ sections = [
724
+ {
725
+ "content": """
726
+ # Executive Summary
727
+
728
+ This report presents our **Q4 2024** performance metrics.
729
+
730
+ ## Key Highlights
731
+
732
+ - Revenue increased by **23%**
733
+ - Customer satisfaction at **94%**
734
+ - Market share grew to **31%**
735
+
736
+ ### Performance Metrics
737
+
738
+ | Metric | Q3 | Q4 | Change |
739
+ |--------|-------|-------|---------|
740
+ | Revenue | $2.3M | $2.8M | +23% |
741
+ | Customers | 1,200 | 1,450 | +21% |
742
+ | NPS Score | 72 | 78 | +8% |
743
+
744
+ <div class="highlight-box">
745
+
746
+ **Important Note:** All figures are preliminary and subject to final audit.
747
+
748
+ </div>
749
+ """,
750
+ "page_break": False
751
+ },
752
+ {
753
+ "content": """
754
+ # Strategic Recommendations
755
+
756
+ 1. **Expand marketing efforts** in Q1 2025
757
+ 2. **Invest in customer support** infrastructure
758
+ 3. **Explore new markets** in Southeast Asia
759
+
760
+ ---
761
+
762
+ *Report generated on January 24, 2026*
763
+ """,
764
+ "page_break": False
765
+ }
766
+ ]
767
+
768
+ success = generator.generate(
769
+ sections=sections,
770
+ filename="Q4_2024_Report.pdf",
771
+ output_dir="./reports"
772
+ )
773
+
774
+ if success:
775
+ print("✓ Report generated successfully!")
776
+ else:
777
+ print("✗ Report generation failed!")