![]() No scaling if the width or height is zero. Get scale ratio required to fit image height - if smaller, use this insteadįloat pageHeight = pageSize.getHeight() - doc.topMargin() - doc.bottomMargin() įloat heightScaleRatio = pageHeight / imageHeight Firstly get the scale ratio required to fit the image widthįloat pageWidth = pageSize.getWidth() - doc.leftMargin() - doc.rightMargin() This can be done as follows: float scaleRatio = calculateScaleRatio(doc, image) In other words, the scaling will only happen if the width doesn't fit in the available width or the height doesn't fit in the available height. How to Print Zoomed-In PDF with EaseUS PDF Editor The first software you can use in Windows OS to enlarge PDF before printing is EaseUS PDF Editor. Sometimes it is useful to only scale down if the image is too large and not scale up if the image fits OK. Once the site is loaded, it can even be used offline 100 free. You can access the tool from anywhere around the globe through the website. jpg instead? I don't really know how well iText handles different image extensions. The PDF resize tool is designed to work just as well from your mobile device as from your desktop computer. I would share the picture of the pdf with you guys but unfortunately I can't. Here is the output for the getScaled() methods. ![]() Click the Tools tab at the top left, scroll down until you see the Optimize PDF tool, then select Open from the drop-down menu. You can access this tool from the Tools center. (watermark_image.getScaledHeight()) Īdd_watermark = pdfStamper.getUnderContent(i) To reduce the size of your PDF file, open the Optimize PDF tool. Image watermark_image = Image.getInstance("abstract(0307).bmp") Get the PdfContentByte type by pdfStamper. How to crop PDF pages with the Crop tool: On the Page Layout tab, in the Pages group, click Crop Do any of the following: Double-click inside the crop area. The document is reduced to a page size that fits the paper size if the page size specified in the PDF file is larger than the printable area of the paper. PdfStamper pdfStamper = new PdfStamper(reader, new FileOutputStream("result_watermark.pdf")) Int number_of_pages = reader.getNumberOfPages() PdfReader reader = new PdfReader("result.pdf") 1 Choose file Select a PDF file to resize: upload the file from your computer or cloud storage service like Google Drive or Dropbox. PdfWriter.getInstance(document, new FileOutputStream("result.pdf")) I am having a lot of trouble trying to resize this picture to fit the page, does anyone have any suggestions? Document document = new Document() I have a watermark that I would like to put into my pdf.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |