Skip to content

Commit

Permalink
(#34) Add Information reference into trailer
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriciofx committed Dec 11, 2023
1 parent 36c44cc commit 57c05f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/github/fabriciofx/cactoos/pdf/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
)
Expand Down Expand Up @@ -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"
)
)
Expand Down Expand Up @@ -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"
)
)
Expand Down

0 comments on commit 57c05f0

Please sign in to comment.