diff --git a/src/main/java/com/github/fabriciofx/cactoos/pdf/Document.java b/src/main/java/com/github/fabriciofx/cactoos/pdf/Document.java index bcdba5b..8fc8d5d 100644 --- a/src/main/java/com/github/fabriciofx/cactoos/pdf/Document.java +++ b/src/main/java/com/github/fabriciofx/cactoos/pdf/Document.java @@ -98,9 +98,10 @@ public byte[] asBytes() throws Exception { baos.write(this.catalog.asBytes()); baos.write( new FormattedText( - "trailer << /Root %s /Size %d >>\n", + "trailer << /Root %s /Size %d /Info %s >>\n", this.catalog.reference(), - this.count.value() + this.count.value(), + this.information.reference() ).asString().getBytes() ); baos.write(Document.EOF.getBytes()); diff --git a/src/test/java/com/github/fabriciofx/cactoos/pdf/DocumentTest.java b/src/test/java/com/github/fabriciofx/cactoos/pdf/DocumentTest.java index d151465..fc51da1 100644 --- a/src/test/java/com/github/fabriciofx/cactoos/pdf/DocumentTest.java +++ b/src/test/java/com/github/fabriciofx/cactoos/pdf/DocumentTest.java @@ -96,7 +96,7 @@ void buildDocument() { "4 0 obj\n<< /Type /Page /Resources 2 0 R /Contents 3 0 R /Parent 5 0 R >>\nendobj", "2 0 obj\n<< /Font << /F1 << /Type /Font /BaseFont /Times-Roman /Subtype /Type1 >> >> >>\nendobj", "3 0 obj\n<< /Length 62 >>\nstream\nBT /F1 18 Tf 0 0 Td\n(Hello World with \\(, \\), \\\\ and \\r) Tj\nET\nendstream\nendobj", - "trailer << /Root 6 0 R /Size 7 >>", + "trailer << /Root 6 0 R /Size 7 /Info 1 0 R >>", "%%%%EOF" ) ) @@ -186,7 +186,7 @@ void buildMultiTextDocument() { "ET", "endstream", "endobj", - "trailer << /Root 6 0 R /Size 7 >>", + "trailer << /Root 6 0 R /Size 7 /Info 1 0 R >>", "%%%%EOF" ) ) @@ -262,7 +262,7 @@ void buildTwoPagesDocument() { "7 0 obj\n<< /Type /Page /Resources 5 0 R /Contents 6 0 R /Parent 8 0 R >>\nendobj", "5 0 obj\n<< /Font << /F1 << /Type /Font /BaseFont /Times-Roman /Subtype /Type1 >> >> >>\nendobj", "6 0 obj\n<< /Length 33 >>\nstream\nBT /F1 18 Tf 0 0 Td\n(World) Tj\nET\nendstream\nendobj", - "trailer << /Root 9 0 R /Size 10 >>", + "trailer << /Root 9 0 R /Size 10 /Info 1 0 R >>", "%%%%EOF" ) )