diff --git a/src/index.js b/src/index.js
index 4713ab2..da9f1d0 100644
--- a/src/index.js
+++ b/src/index.js
@@ -178,7 +178,7 @@ export function toPDFMake(tag) {
const info = pick(attributes, ['title', 'author', 'subject', 'keywords']);
- if (info.length > 0) {
+ if (Object.keys(info).length > 0) {
result.info = info;
}
diff --git a/src/index.test.js b/src/index.test.js
index 4679556..195ded1 100644
--- a/src/index.test.js
+++ b/src/index.test.js
@@ -431,7 +431,17 @@ describe('#jsx-pdf', () => {
});
});
- it('should error if a top level element appears below the top level', () => {
+ ['title', 'author', 'subject', 'keywords'].forEach(field => {
+ it(`should set ${field} in info`, () => {
+ expect(toPDFMake()).toEqual({
+ info: {
+ [field]: 'foo',
+ },
+ });
+ });
+ });
+
+ it('should error if a top-level element appears below the top level', () => {
expect(() => {
toPDFMake(