/** * Use this method to get the current vertical page position. * @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects * for elements that do not terminate the lines they've started because those lines will get * terminated. * @return The current vertical page position. */ public float getVerticalPosition(final boolean ensureNewLine) { return pdf.getVerticalPosition(ensureNewLine); }
/** * Use this method to get the current vertical page position. * @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects * for elements that do not terminate the lines they've started because those lines will get * terminated. * @return The current vertical page position. */ public float getVerticalPosition(final boolean ensureNewLine) { return pdf.getVerticalPosition(ensureNewLine); }
public static float getAvailableHeight(PdfDocument pdfDocument) { Float indentBottom = pdfDocument.bottomMargin(); try { Method method = pdfDocument.getClass().getDeclaredMethod("indentBottom"); method.setAccessible(true); indentBottom = (Float) method.invoke(pdfDocument); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } float offset = pdfDocument.top() - pdfDocument.getVerticalPosition(false); return pdfDocument.getPageSize().getHeight() - offset - pdfDocument.topMargin() - indentBottom - pdfDocument.bottomMargin(); }