I have a picture on a JPanel and the size of Panel is 700x440 I need to print this panel with the size of 243x154 as a card size. I used paper.setSize(243,154) but still its printing with the same 700x440 size. How I print this with the 243x154 size. If i save Panel or save picture with this size the quality of picture effected. So I have to print this 700x440 Panel with 253x154 size. Please anyone help. Here is my Code:
Your component is 700x440, your page is 253x154. The scale should therefore be the ratio between the two: 253 / 770 and 154 / 440. Remember to cast to float / double before dividing though, or both will be 0.