-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
escape single parenthesis when generating fdf files
- Loading branch information
Justin Williamson
committed
Mar 10, 2020
1 parent
5c91fe8
commit 4123256
Showing
4 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
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
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
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,24 @@ | ||
%FDF-1.2 | ||
%���� | ||
1 0 obj | ||
<< | ||
/FDF | ||
<< | ||
/Fields [ | ||
<< | ||
/V ([email protected]) | ||
/T (email) | ||
>> | ||
<< | ||
/V (John Doe\)) | ||
/T (name) | ||
>>] | ||
>> | ||
>> | ||
endobj | ||
trailer | ||
|
||
<< | ||
/Root 1 0 R | ||
>> | ||
%%EOF |
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 |
---|---|---|
|
@@ -135,6 +135,23 @@ describe('fillForm', function () { | |
.catch(err => expect(err).to.be.null); | ||
}); | ||
|
||
it('should escape single parenthesis', function () { | ||
|
||
const testFile = fs.readFileSync(path.join(__dirname, './files/filledformescape.temp.pdf')); | ||
const input = path.join(__dirname, './files/form.pdf'); | ||
|
||
return pdftk | ||
.input(input) | ||
.fillForm({ | ||
name: 'John Doe)', | ||
email: '[email protected]', | ||
}) | ||
.flatten() | ||
.output() | ||
.then(buffer => expect(buffer.equals(testFile)).to.be.true) | ||
.catch(err => expect(err).to.be.null); | ||
}); | ||
|
||
it('should catch an error if given a bad input path', function () { | ||
|
||
const input = path.join(__dirname, './files/doesnotexist.pdf'); | ||
|