Hi, I am new to iText. I am trying to use iText to add images to pdf uploaded by user using FormFile in jsp which are of different sizes (or different resolutions). The user may not know the size of the image he just browse and select the images to add to pdf. I wrote the program like below
*new File("c://abc").mkdir(); File directory = new File("C://abc"); FileForm file2 = (FileForm) form; ArrayList list = file2.getList(); String test = "false"; FileOutputStream outputStream = null; Document document=new Document(PageSize.A4,0,0,10,10); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("c:\\ImagetoPDF.pdf")); writer.setStrictImageSequence(true); document.open(); for (int count = 0; count < list.size(); count++) { FormFile f1 = (FormFile) list.get(count); outputStream = new FileOutputStream(directory.getPath()+"//"+f1.getFileName()); outputStream.write(f1.getFileData()); Image convertJpg=Image.getInstance(directory.getPath()+"//"+f1.getFileName()); //document.newPage(); document.add(convertJpg); } document.close(); File[] files = directory.listFiles(); for (File file : files){ file.delete(); file.deleteOnExit(); } directory.delete(); directory.deleteOnExit();* My problem is I am not able to store the images one by one in the sequence selcted by user. some images were missing in between if there resolutions are different and I am not able to know the resolution of the image. Just I can know the size of the image. And only one page is getting created whatever the images that can be fit in to that page are stored others were skipped. If I use newpage() then the pdf is creating new page for each image. I dont want this. Is it possible to resize all the images irrespective of their sizes(resolutions) to same display size and also I want to store the images in the order same as they were selected. Another is once the page is filled then the other images to be stored in the new page. Someone guide me to achieve this. Thanking you. --regards, raaja. g -- View this message in context: http://itext-general.2136553.n4.nabble.com/Positioning-images-of-different-sizes-tp3677336p3677336.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Magic Quadrant for Content-Aware Data Loss Prevention Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions. http://www.accelacomm.com/jaw/sfnl/114/51385063/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php