diegomura / diegomura/react-pdf

How to get the size of a view programatically

Open
#2,385 1 comment 5 reactions 0 assignees View on GitHub
new feature
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Is your feature request related to a problem? Please describe.**
We are trying to find a way to get the width and height in PT of each rendered component.

**Describe the solution you'd like**
Maybe exposing those values from the View, Text, Image, etc components would be a valuable.

**Describe alternatives you've considered**
We have tried implementing some HTML with styles similar to the printed pdf size, and converting PX to PT but the value, even though it is close, is not accurate.

**Additional context**
What we really need is to get the same numbers that appear on `debug={true}` so that we can make some decisions depending on the size of the elements.

Screen Shot 2023-08-23 at 4 38 02 PM

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.