manuelbl/SwissQRBill

Is there an option to print QR Bill at Top of the New Page?

suneet133 opened this issue · 2 comments

Hello,

Is there an option in the Library to print the qr bill on top position instead of bottom when using:
PDFCanvas.NEW_PAGE_AT_END.

My usecase is to print two qr bills on one page.

Any help is much appreciated.
Thanks

Currently, there is no straight-forward way to do it as the standard says the QR bill must be at the bottom of the page. But I fully see your use case and I have seen similar solution with the old payment slip.

In order to implement it, you will need to use the PDFBox library directly. The master branch contains an enhanced PdfCanvas class. It and the associated test cases could be useful for you. Note however that they haven't been released yet and thus are not available from Maven Central.

The test case addPageToOpenContentStream and in particular line 92 show how to draw a QR bill with an offset (from the bottom). You could simply run this code twice with two different offsets and two different bills.

Additionally, the test case addPageToOpenPdfDocument shows how to open an existing PDF and add a new page.

The enhanced PdfCanvas class has now been released as part of version 3.0.2.