File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed
frontend/src/features/admin-form/responses/IndividualResponsePage Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ import {
2020 Stack ,
2121 Text ,
2222} from '@chakra-ui/react'
23- import { datadogLogs } from '@datadog/browser-logs'
2423import { useFeatureIsOn , useGrowthBook } from '@growthbook/growthbook-react'
2524
2625import { featureFlags } from '~shared/constants'
@@ -35,6 +34,7 @@ import { useUnlockedResponses } from '../ResponsesPage/storage/UnlockedResponses
3534
3635import PrintableResponse from './PrintableResponse'
3736import { useIndividualSubmission } from './queries'
37+ import generatePdf from './generatePdf'
3838
3939export const IndividualResponseNavbar = ( ) : JSX . Element => {
4040 const { state } = useLocation ( )
@@ -175,19 +175,7 @@ export const IndividualResponseNavbar = (): JSX.Element => {
175175 aria-label = "Print"
176176 icon = { < FaRegFilePdf /> }
177177 isLoading = { isLoading || isFormLoading }
178- onClick = { ( ) => {
179- datadogLogs . logger . info (
180- `IndividualResponseNavbar: admin printing pdf` ,
181- {
182- meta : {
183- action : 'adminPrintPdf' ,
184- userId : user ?. _id ,
185- submissionId : submissionId ,
186- } ,
187- } ,
188- )
189- reactToPrintFn ( )
190- } }
178+ onClick = { generatePdf }
191179 variant = "clear"
192180 />
193181 < PrintableResponse ref = { printableResponseRef } />
Original file line number Diff line number Diff line change 1+ import pdfMake from 'pdfmake/build/pdfmake'
2+ import pdfFonts from 'pdfmake/build/vfs_fonts'
3+
4+ pdfMake . vfs = pdfFonts . vfs
5+
6+ const docDefinition = { content : 'This is a sample PDF printed with pdfMake' }
7+
8+ const generatePdf = ( ) => {
9+ return pdfMake . createPdf ( docDefinition ) . download ( 'response.pdf' , ( ) => {
10+ console . log ( 'PDF downloaded' )
11+ } )
12+ }
13+
14+ export default generatePdf
You can’t perform that action at this time.
0 commit comments