I am trying to develop some code with 3rd party php library to generate pdf of a specific webpage. I have some question regarding the image rescaling, page size and the printing page size. I am totally newbie to css and html coding, so please ignore this post if my question is irrelevant to do css or html. I am working on a webpage with layout and formatting controlled by some css. The page width is pretty wide and all images width are about 500pt and about 1/2 as wide as the page. There is also an edit field allow user to input and submitted some text. All the submitted text will be shown in tag. I am going to print the page in PDF of A4 size but the page size is not same as the A4 size, the images shown in PDF looks pretty strange because the size doesn't scale down proportionally because I set the width of images to 500 in the pdf too. I am thinking it might solve the problem if Irescale the image based on the ratio of the page width and pdf page width. But my problem is how to figure out the webpage width in php? I think the page width is not same the the browser page width, doesn't it? Also, even there is a way to figure out the width of the page, will the width changed in different machine with different browser? When I open the webpage in my computer, it is pretty wide but if I open it somewhere else with different browser, it seems that all images' width will be scaled down automatically. So in that case, the ratio of the image width to the page width will vary from machine to machine and from browser to browser?The similar issue is the tag to show the text submitted by user literally. Since the user doesn't know how the code to print the page, he/she might type something very lengthy without a return. So if I print whatever he/she type literally, some text will be outside the PDF page if they are too long. I am looking for one way to visualize the region in which the user should have their words typed inside. I am thinking if it is possible to show a vertical dash line on the background of the region so the user know if they type too long without a break. Of course, where to put the dash line depends on the size of A4 and the fontsize used in the . It might be difficult to implement that in html or with css. Since I have very limited experience in both language, your suggestion or comment will be highly appreciated.