Skip to content

Commit

Permalink
Temporary commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Nov 17, 2023
1 parent 1acb890 commit 2f2c2bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
PdfWriter pdfWriter = PdfWriter.getInstance( document, baos );
// create doc handler
OpenPpfDocHandler handler = new OpenPpfDocHandler( document, pdfWriter );
pdfWriter.setPageEvent( new PageNumbersEventHandler( docBase ) );
//pdfWriter.setPageEvent( new PageNumbersEventHandler( docBase ) );
handler.handleDoc( docBase );
baos.writeTo( outputStream );
baos.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onEndPage(PdfWriter writer, Document document) {
DocElement current = itElements.next();
if ( current instanceof DocPara ) {
DocPara para = (DocPara) current;
String text = OpenPpfDocHandler.createText( docHelper.getParams(), para.getText() );
String text = OpenPpfDocHandler.createText( docHelper.getParams(), para.getText() ).replace( PageNumberHelper.PAGE_COUNT , "" );
float textSize = baseFont.getWidthPoint(text, footerTextSize);
float textBase = document.bottom() - totalOffset;
int rowOffset = 10;
Expand All @@ -90,7 +90,6 @@ public void onEndPage(PdfWriter writer, Document document) {
cb.setTextMatrix(document.right() - textSize - adjust, textBase);
cb.showText(text);
}

totalOffset+= rowOffset;
} else {
throw new ConfigRuntimeException( "Element not allowed in footer (accepted only DocPara) : "+current );
Expand All @@ -110,6 +109,7 @@ public void onCloseDocument(PdfWriter writer, Document document) {
totalPages.setTextMatrix(0, 0);
totalPages.showText(String.valueOf( writer.getPageNumber() - 1) );
totalPages.endText();
totalPages.sanityCheck();
}

public void setPageNumberAlignment(int pageNumberAlignment) {
Expand Down

0 comments on commit 2f2c2bc

Please sign in to comment.