Hi
   Firstly ,I open the pdf template file with different size ,then write
some signatures in and output as a new pdf file.But new file can not
maintain the original size.I am not sure why this is happening 

            com.lowagie.text.pdf.PdfReader reader = new
com.lowagie.text.pdf.PdfReader(path);
            com.lowagie.text.Document document = new
com.lowagie.text.Document();

            afileName = "app_" + tmpFileName;
            PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(pathstr + File.separator
                    + afileName));

            document.open();
          
            n = reader.getNumberOfPages();
            for (int i = 1; i < n + 1; i++) {
                Rectangle psize = reader.getPageSize(i);
                String capptype = (String) pageMap.get(Integer.toString(i));

                float height = psize.height();
                float width = psize.width();

                if (VERBOSE)
                    System.out.println("doc height: " + height);
                if (VERBOSE)
                    System.out.println("doc width: " + width);
                rectPageSize = new Rectangle(width, height);
          PdfContentByte cb = writer.getDirectContent();
                String size = getSpecPropertiesValue("ext.config.filetype", 
"SIZE");
                PdfImportedPage pagei = writer.getImportedPage(reader, i);
                if (size.equals("A4")) {
                    cb.addTemplate(pagei, 0, 0);
                } else
                    cb.addTemplate(pagei, 0, -1f, 1f, 0, 0,
reader.getPageSizeWithRotation(i).height());
                cb.beginText();

                ........
                 cb.endText();
                document.newPage();
                }
                document.close();

        
-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/How-to-merge-the-pages-with-different-size-into-one-pdf-file-tp2325079p2325079.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to