Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure a space before PDF arrays are written, even in non-verbose mode #443

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

RenderMichael
Copy link
Contributor

@RenderMichael RenderMichael commented May 23, 2024

Fixes #442

According to the spec, section 7.5.5, the trailer dictionary is shown to be space separated. Unfortunately that's not explicitly stated, so perhaps PDF parsers should be able to accept the following line:

/ID[<FCEAE9E3BEA9864C83AA492B76687F02><FCEAE9E3BEA9864C83AA492B76687F02>]

However, if we think that a space after /ID is good, then this PR fixes that.

Before:

Before
%PDF-1.4
%����
1 0 obj
<<
/CreationDate(D:20240522141508-04'00')
/Creator<FEFF0050004400460073006800610072007000200031002E00350030002E0034003000300030002D006E00650074007300740061
006E00640061007200640020002800680074007400700073003A002F002F006700690074006800750062002E0063006F
006D002F007300740073007400650069006700650072002F005000640066005300680061007200700043006F00720065
0029>
/Producer(PDFsharp 1.50.4000-netstandard \(https://github.com/ststeiger/PdfSharpCore\))
>>
endobj
2 0 obj
<<
/Type/Catalog
/Pages 3 0 R
>>
endobj
3 0 obj
<<
/Type/Pages
/Count 1
/Kids[4 0 R]
>>
endobj
4 0 obj
<<
/Type/Page
/MediaBox[0 0 612 792]
/Parent 3 0 R
/Group
<<
/CS/DeviceRGB
/S/Transparency
>>
>>
endobj
xref
0 5
0000000000 65535 f 
0000000015 00000 n 
0000000477 00000 n 
0000000525 00000 n 
0000000580 00000 n 
trailer
<<
/ID[<FCEAE9E3BEA9864C83AA492B76687F02><FCEAE9E3BEA9864C83AA492B76687F02>]
/Info 1 0 R
/Root 2 0 R
/Size 5
>>
startxref
692
%%EOF

After:

After
%PDF-1.4
%����
1 0 obj
<<
/CreationDate (D:20240523110806-04'00')
/Creator <FEFF0050004400460073006800610072007000200031002E00350030002E0034003000300030002D006E00650074007300740061
006E00640061007200640020002800680074007400700073003A002F002F006700690074006800750062002E0063006F
006D002F007300740073007400650069006700650072002F005000640066005300680061007200700043006F00720065
0029>
/Producer (PDFsharp 1.50.4000-netstandard \(https://github.com/ststeiger/PdfSharpCore\))
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
3 0 obj
<<
/Type /Pages
/Count 1
/Kids [4 0 R]
>>
endobj
4 0 obj
<<
/Type /Page
/MediaBox [0 0 612 792]
/Parent 3 0 R
/Group
<<
/CS /DeviceRGB
/S /Transparency
>>
>>
endobj
xref
0 5
0000000000 65535 f 
0000000015 00000 n 
0000000480 00000 n 
0000000529 00000 n 
0000000586 00000 n 
trailer
<<
/ID [<6751B1FD3ECE5F4FAA48B04D7CC83F7D><6751B1FD3ECE5F4FAA48B04D7CC83F7D>]
/Info 1 0 R
/Root 2 0 R
/Size 5
>>
startxref
702
%%EOF

@ststeiger ststeiger merged commit c771d63 into ststeiger:master Jul 12, 2024
0 of 4 checks passed
@ststeiger
Copy link
Owner

Merged.

@RenderMichael RenderMichael deleted the id-format branch July 12, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailer: ID is not space-separated.
2 participants