diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
15.02k stars 1.19k forks source link

Empty page with inside element having height 0 #2909

Open typesafeui opened 1 month ago

typesafeui commented 1 month ago

Describe the bug React pdf creates an empty page having no elements when having multiple inside the same . The rendered empty page seen inside the INTERNALLAYOUTDATA has a single component with height: 0

This is the empty page inside INTERNALLAYOUTDATA:

{
    "type": "PAGE",
    "box": {
        "paddingTop": 32,
        "paddingRight": 48,
        "paddingBottom": 32,
        "paddingLeft": 48,
        "marginTop": 0,
        "marginRight": 0,
        "marginBottom": 0,
        "marginLeft": 0,
        "borderTopWidth": 0,
        "borderRightWidth": 0,
        "borderBottomWidth": 0,
        "borderLeftWidth": 0,
        "top": 0,
        "right": 0,
        "bottom": 0,
        "left": 0,
        "width": 595.280029296875,
        "height": 841.8900146484375
    },
    "style": {
        "paddingTop": 32,
        "paddingRight": 48,
        "paddingBottom": 32,
        "paddingLeft": 48,
        "fontFamily": "Open Sans",
        "width": 595.28,
        "height": 841.89
    },
    "props": {
        "size": "A4"
    },
    "children": [
        {
            "type": "VIEW",
            "box": {
                "paddingTop": 0,
                "paddingRight": 0,
                "paddingBottom": 0,
                "paddingLeft": 0,
                "marginTop": 0,
                "marginRight": 0,
                "marginBottom": 0,
                "marginLeft": 0,
                "borderTopWidth": 0,
                "borderRightWidth": 0,
                "borderBottomWidth": 0,
                "borderLeftWidth": 0,
                "top": 32,
                "right": 0,
                "bottom": 0,
                "left": 48,
                "width": 499.280029296875,
                "height": 0
            },
            "style": {
                "fontFamily": "Open Sans",
                "marginTop": 0,
                "paddingTop": 0,
                "borderTopWidth": 0,
                "borderTopLeftRadius": 0,
                "borderTopRightRadius": 0
            },
            "props": {
                "debug": true
            },
            "children": [],
            "origin": {
                "left": 297.6400146484375,
                "top": 32
            }
        }
    ],
    "origin": {
        "left": 297.6400146484375,
        "top": 420.94500732421875
    }
}

Expected behavior Not have the empty page

Screenshots image

Desktop (please complete the following information):

diegomura commented 1 week ago

Can you please provide the actual document? The internal layout is just the outcome but can't know how it got in that state