How to dynamically render PDFs with variant changes in JS?

Hi All, hoping you can help me here. I am a beginner and I am tring to access when a specific size more specifically if someone selects Custom Size as an option I want to an input field to appear.

I am access the following variable

{% assign current = product.selected_or_first_available_variant %}
{{ current.title }}

but this seems to be static. Can you please help me understand how I can check when the size value changes and access that?