Files
portfolio/app/composables/useResumePdf.ts
T
mahdiarghyani 9c40914d6a feat(resume): complete Epic 4 - Resume Content Strategy and Guidelines
- Update resume data with comprehensive professional summary and optimized work experience highlights
- Add resume content tech-spec and strategy documentation for 2025 best practices
- Create resume guidelines reference document for content consistency
- Enhance PDF composable with openPdf preview function alongside downloadPdf
- Expand CSS banner hiding rules to block certificates.dev promotional content
- Add research documentation on resume best practices and ATS optimization
- Update i18n translations for resume content in English and Persian
- Include sample Ali Arghyani resume PDF template in design assets
- Refactor resume.en.ts with improved professional positioning and achievement metrics
- Update API route documentation for PDF generation story artifacts
- Establish foundation for Epic 4 sprint planning with tech specifications
2025-12-02 12:54:26 +03:30

50 lines
1.2 KiB
TypeScript

/**
* PDF Download Composable
* Handles PDF generation with preview in new tab
*/
export function useResumePdf() {
const isGenerating = ref(false)
const { getPdfFilename } = useResumeData()
// Open PDF in new tab for preview (user can download from there)
async function openPdf() {
if (isGenerating.value) return
isGenerating.value = true
try {
const filename = getPdfFilename()
// Opens PDF in browser's built-in viewer
window.open(`/api/resume/pdf?filename=${encodeURIComponent(filename)}`, '_blank')
await new Promise((resolve) => setTimeout(resolve, 1500))
} finally {
isGenerating.value = false
}
}
// Force download PDF directly
async function downloadPdf() {
if (isGenerating.value) return
isGenerating.value = true
try {
const filename = getPdfFilename()
// download=true forces attachment header
window.open(`/api/resume/pdf?filename=${encodeURIComponent(filename)}&download=true`, '_blank')
await new Promise((resolve) => setTimeout(resolve, 1500))
} finally {
isGenerating.value = false
}
}
return {
isGenerating,
openPdf,
downloadPdf,
}
}