Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
dx(command): make command to output a test PDF
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 13, 2022
1 parent a5e9a34 commit c7d20c8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/cli/test_pdf.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { writeFile } from "fs"
import { promisify } from "util"

import { generatePdf } from "html-pdf-node-ts"

import RequestEnvironment from "$!/singletons/request_environment"

async function main() {
console.log("Generating PDF...")

const outputPath = `${RequestEnvironment.root}/t/data/hidden_test.pdf`
const outputContents = await generatePdf({
"url": "https://example.com"
})
await promisify(writeFile)(outputPath, outputContents)

console.log("PDF Generated.")
}

main()

0 comments on commit c7d20c8

Please sign in to comment.