-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cf5c7a
commit c2c64b0
Showing
4 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import fs from 'fs' | ||
import * as got from '../../src' | ||
|
||
// need to run Gotenberg like this | ||
// docker run --rm -p 3500:3000 gotenberg/gotenberg:7 | ||
|
||
got | ||
.pipe( | ||
got.gotenberg(''), | ||
got.merge, | ||
got.adjust({ | ||
// manually adjust endpoint, because | ||
// gotenberg:7 has different one | ||
url: 'http://localhost:3500/forms/libreoffice/convert', | ||
|
||
// manually adjust for fields | ||
fields: { | ||
merge: true, | ||
// `merge` is not valid field for gotenberg:6 | ||
// so we have to cast to any, otherwise typescript will complain | ||
} as any, // if you don't use typescript, just remove `as any` casting | ||
}), | ||
got.please | ||
)({ | ||
'in1.docx': `file://${__dirname}/in1.docx`, | ||
'in2.docx': `file://${__dirname}/in2.docx`, | ||
'in3.docx': `file://${__dirname}/in3.docx`, | ||
}) | ||
.then((pdf) => pdf.pipe(fs.createWriteStream(`${__dirname}/out1.pdf`))) | ||
.catch(console.error) |