Gkemon/Android-XML-to-PDF-Generator

Can't generate view in the bottom of the page if full page is't filled up.

devnizamuddin opened this issue · 3 comments

I am generating an invoice with that pdf, but the problem is the signature part of the invoice gets up if the full paper isn't filled up.
I tried with a different layout but the result is the same.

Can you share the following XML,please?

`

<LinearLayout
    android:orientation="vertical"
    android:id="@+id/invoice_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="48dp">

    <!-- Our Store Name-->
    <TextView
        android:layout_gravity="center"
        android:id="@+id/shop_name_invoice_tv"
        style="@style/InvoiceLargeTextStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:text="@string/our_shop_name" />

    <!--Our Address-->

    <!--Invoice Text-->
    <RelativeLayout
        android:id="@+id/invoice_text_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/shop_name_invoice_tv">

        <TextView
            style="@style/InvoiceMediumTextStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="24dp"
            android:text="INVOICE" />

        <TextView
            style="@style/InvoiceMediumTextStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginTop="8dp"
            android:layout_marginBottom="24dp"
            android:text="Customer Copy"
            android:textSize="14sp" />
        <!--24-->
    </RelativeLayout>

    <!-- Order Info-->
    <LinearLayout
        android:id="@+id/order_info_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/invoice_text_layout"
        android:layout_marginBottom="32dp"
        android:orientation="horizontal"
        android:weightSum="2">

        <!--user information-->
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:weightSum="3">

            <TextView
                android:id="@+id/customer_shop_name_tv"
                style="@style/InvoiceNormalTextStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="@string/customer_shop_name" />

            <TextView
                android:id="@+id/customer_address_tv"
                style="@style/InvoiceNormalTextStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_marginTop="4dp"
                android:layout_weight="1"
                android:text="@string/customer_address" />

            <TextView
                android:id="@+id/customer_phone_tv"
                style="@style/InvoiceNormalTextStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_marginTop="4dp"
                android:layout_weight="1"
                android:text="@string/customer_phone" />

        </LinearLayout>

        <!--Date Time-->
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:weightSum="2">

            <TextView
                android:id="@+id/customer_order_date_tv"
                style="@style/InvoiceNormalTextStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="end"
                android:text="@string/customer_order_date" />

            <TextView
                android:id="@+id/our_delivery_date_tv"
                style="@style/InvoiceNormalTextStyle"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_marginTop="4dp"
                android:layout_weight="1"
                android:gravity="end"
                android:text="@string/our_delivery_date" />

        </LinearLayout>

    </LinearLayout>

    <!--Product List-->
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/invoice_rv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/order_info_layout"
        android:background="@drawable/invoice_item_background"
        android:padding="1dp" />

    <!-- Signature Layout-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_gravity="bottom"
        android:gravity="bottom"
        android:layout_marginTop="48dp"
        android:orientation="horizontal"
        android:weightSum="3">

        <TextView
            style="@style/InvoiceMediumTextStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Customer Signature" />

        <TextView
            style="@style/InvoiceMediumTextStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Prepared By" />

        <TextView
            style="@style/InvoiceMediumTextStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="end"
            android:text="Authorized Signature" />
    </LinearLayout>

</LinearLayout>

<Button
    android:id="@+id/generate_invoice_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:text="Generate Invoice" />

`

I rearranged the mentioned XML here and you will get more insight here