Skip to main content

Export Resume Analysis as PDF

Generates and downloads a professionally formatted PDF report containing the complete resume analysis, including scores, strengths, suggestions, and visualizations.

Endpoint

GET /api/resumes/{id}/export

Authentication

This endpoint requires authentication. Include your authentication token in the request headers.

Path Parameters

id
long
required
The unique identifier of the resume whose analysis report to export

Response

This endpoint returns a binary PDF file with appropriate headers for file download.

Response Headers

Content-Type
string
Set to application/pdf
Content-Disposition
string
Set to attachment; filename*=UTF-8''<encoded_filename>.pdfThe filename follows the pattern: 简历分析报告_<original_filename>.pdf

Response Body

Binary PDF file content containing:
  • Resume metadata (filename, upload date, analysis date)
  • Overall score with visual indicator
  • Detailed score breakdown (content, structure, skills, expression, projects)
  • Score visualization charts
  • Identified strengths (bulleted list)
  • Improvement suggestions (categorized list)
  • AI-generated summary
  • Branding and professional formatting

Examples

curl -X GET https://api.example.com/api/resumes/12345/export \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -O -J

Success Response

HTTP Status: 200 OK

Headers:
Content-Type: application/pdf
Content-Disposition: attachment; filename*=UTF-8''%E7%AE%80%E5%8E%86%E5%88%86%E6%9E%90%E6%8A%A5%E5%91%8A_john_doe_resume.pdf.pdf
Body: Binary PDF file content

Error Responses

Error Codes
object

Error Response Format

Unlike successful responses (which return binary PDF), errors return JSON:
{
  "code": 2008,
  "message": "简历分析结果不存在",
  "data": null
}

HTTP Status: 500 Internal Server Error

If PDF generation fails, the endpoint returns an HTTP 500 status with an empty body.

PDF Report Contents

The generated PDF includes the following sections:
  • Report title: “简历分析报告” (Resume Analysis Report)
  • Resume filename
  • Upload timestamp
  • Analysis timestamp
  • Report generation date
  • Large, prominent overall score display
  • Score interpretation (Exceptional/Excellent/Good/Average/Needs Improvement)
  • Visual score indicator (color-coded)
Detailed scores with visual bars:
  • Content Score (内容分数)
  • Structure Score (结构分数)
  • Skill Match Score (技能匹配)
  • Expression Score (表达分数)
  • Project Score (项目经验)
  • Title: “主要优势” (Key Strengths)
  • Bulleted list of identified strengths
  • Professional formatting with icons
  • Title: “改进建议” (Improvement Suggestions)
  • Categorized suggestions:
    • Content Optimization (内容优化)
    • Structure Improvement (结构改进)
    • Skill Enhancement (技能展示)
  • Detailed descriptions for each suggestion
  • Title: “AI 分析总结” (AI Analysis Summary)
  • AI-generated comprehensive summary
  • Professional narrative format

PDF Specifications

  • Format: PDF 1.4 compatible
  • Page Size: A4 (210 × 297 mm)
  • Orientation: Portrait
  • Encoding: UTF-8 with full Chinese character support
  • Fonts: Embedded Chinese fonts for proper rendering
  • File Size: Typically 200-500 KB depending on content length
  • Color: Full color with professional branding

Implementation Notes

Prerequisites: The resume must have at least one completed analysis before export. If analysis is still PENDING or has FAILED, the export will fail with error code 2008.
Filename Encoding: The Content-Disposition header uses RFC 5987 encoding (filename*=UTF-8''...) to properly handle Chinese characters in filenames. Modern browsers will automatically decode this.
Caching: Generated PDFs are created on-demand and not cached. Each export request generates a fresh PDF with the latest analysis data.

Use Cases

  1. Portfolio Building: Download analysis reports for personal records
  2. Progress Tracking: Compare exported reports over time as resume improves
  3. Sharing with Mentors: Send PDF reports to career coaches or mentors for feedback
  4. Job Application Documentation: Include analysis as supplementary material
  5. Offline Review: Review analysis without requiring internet access

Best Practices

Before offering export functionality, verify the resume has completed analysis:
const detail = await fetch(`/api/resumes/${id}/detail`).then(r => r.json());

if (detail.data.analyzeStatus !== 'COMPLETED') {
  alert('Analysis not yet complete. Please wait.');
  return;
}

// Proceed with export
window.location.href = `/api/resumes/${id}/export`;
Different browsers handle file downloads differently. Use the Blob API for maximum compatibility:
async function downloadPDF(resumeId) {
  const response = await fetch(`/api/resumes/${resumeId}/export`);
  
  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.message);
  }
  
  const blob = await response.blob();
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = url;
  link.download = `resume_analysis_${resumeId}.pdf`;
  link.click();
  URL.revokeObjectURL(url);
}
PDF generation can take 1-3 seconds. Show loading indicators:
async function exportWithFeedback(resumeId) {
  showLoadingSpinner();
  
  try {
    await downloadPDF(resumeId);
    showSuccess('PDF exported successfully!');
  } catch (error) {
    showError(`Export failed: ${error.message}`);
  } finally {
    hideLoadingSpinner();
  }
}

Build docs developers (and LLMs) love