Fix financial table rendering and enhance PDF generation
- Fix [object Object] issue in PDF financial table rendering - Enhance Key Questions and Investment Thesis sections with detailed prompts - Update year labeling in Overview tab (FY0 -> LTM) - Improve PDF generation service with page pooling and caching - Add better error handling for financial data structure - Increase textarea rows for detailed content sections - Update API configuration for Cloud Run deployment - Add comprehensive styling improvements to PDF output
This commit is contained in:
@@ -310,18 +310,27 @@ class JobQueueService extends EventEmitter {
|
||||
if (result.summary) {
|
||||
try {
|
||||
const { pdfGenerationService } = await import('./pdfGenerationService');
|
||||
const timestamp = Date.now();
|
||||
const pdfPath = `uploads/summaries/${documentId}_${timestamp}.pdf`;
|
||||
const fullPdfPath = path.join(process.cwd(), pdfPath);
|
||||
const { fileStorageService } = await import('./fileStorageService');
|
||||
|
||||
const pdfGenerated = await pdfGenerationService.generatePDFFromMarkdown(
|
||||
result.summary,
|
||||
fullPdfPath
|
||||
);
|
||||
// Generate PDF buffer
|
||||
const pdfBuffer = await pdfGenerationService.generateCIMReviewPDF(result.analysisData);
|
||||
|
||||
if (pdfGenerated) {
|
||||
updateData.summary_pdf_path = pdfPath;
|
||||
logger.info(`PDF generated successfully for document: ${documentId}`, { pdfPath });
|
||||
if (pdfBuffer) {
|
||||
// Save PDF to GCS
|
||||
const timestamp = Date.now();
|
||||
const pdfFilename = `${documentId}_cim_review_${timestamp}.pdf`;
|
||||
const pdfPath = `summaries/${pdfFilename}`;
|
||||
|
||||
// Upload PDF buffer to GCS using the new method
|
||||
const saved = await fileStorageService.saveBuffer(pdfBuffer, pdfPath, 'application/pdf');
|
||||
|
||||
if (saved) {
|
||||
// Note: summary_pdf_path column doesn't exist in current database schema
|
||||
// updateData.summary_pdf_path = pdfPath;
|
||||
logger.info(`PDF generated and uploaded to GCS successfully for document: ${documentId}`, { pdfPath });
|
||||
} else {
|
||||
logger.warn(`Failed to upload PDF to GCS for document: ${documentId}`);
|
||||
}
|
||||
} else {
|
||||
logger.warn(`Failed to generate PDF for document: ${documentId}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user