PDF and image are similar. Move the logic from the template to the component