-
Notifications
You must be signed in to change notification settings - Fork 598
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
Header and Footer phrase is no longer being rendered #781
Comments
I forgot to mention that if I revert back to OpenPDF Version: 1.3.28 (via Maven) then the header/footer work properly. |
can confirm same behavior on macOS (12.1) with openjdk 17.0.1; also works here w/ version 1.3.28 |
this is most likely due to this commit ea9e5c6 |
Pull requests are welcome. |
renoth
pushed a commit
to renoth/OpenPDF
that referenced
this issue
Sep 14, 2022
- fis wrong deletion of Chunk in Phrase in HeaderFooter - added Test for HeaderFooter#paragraph
1 task
1 task
asturio
pushed a commit
that referenced
this issue
Sep 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The document header and footer are no longer being rendered in version 1.3.29 when solely set with Phrase(). However, if you change the "numbered" option to TRUE then the header and footer are rendered but only with the page number. The supplied Phrase() is not being rendered.
To Reproduce
Document document = new Document( PageSize.Letter );
PdfWriter.getInstance( document, new FileOutputStream( "/tmp/output.pdf" ) );
/* Set document properties */
document.addAuthor( "Author" );
document.addCreator( this.getClass().getSimpleName() );
document.addCreationDate();
document.addKeywords( "some,key,words" );
document.addSubject( "Subject" );
document.addTitle( "Title" );
document.setDocumentLanguage( "ENG" );
/* Header */
Font headerFont = FontFactory.getFont( FontFactory.COURIER );
headerFont.setSize( 16.0f );
headerFont.setStyle( Font.BOLD );
HeaderFooter header = new HeaderFooter(new Phrase( "This is a header.", headerFont ), false );
header.setAlignment( Element.ALIGN_CENTER );
header.setBorder( Rectangle.NO_BORDER );
document.setHeader( header );
/* Footer */
Font footerFont = FontFactory.getFont( FontFactory.COURIER );
footerFont.setSize( 8.0f );
HeaderFooter footer = new HeaderFooter( new Phrase( "This is a footer.", footerFont ), false ); // does not render anything
// HeaderFooter footer = new HeaderFooter( new Phrase( "This is a footer.", footerFont ), true ); // only page# rendered
footer.setAlignment( Element.ALIGN_CENTER );
footer.setBorder( Rectangle.NO_BORDER );
document.setFooter( footer );
document.open();
/* Body */
Font bodyFont = FontFactory.getFont( FontFactory.COURIER );
bodyFont.setSize( 12.0f );
document.add( new Paragraph( "Hello World", bodyFont ) );
document.add( Chunk.NEXTPAGE );
document.add( new Paragraph("Hello new page.", bodyFont ) );
/* Close */
document.close();
Expected behavior
Header and footer phrase should also render.
Screenshots
System (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: