Ning Zhao wrote: > Is there any better way in iText to change the page size that I haven't > known?
Yes. PdfCopy just copies the original pages with their original page size. The fact that the XMP metadata isn't copied might be a bug. PdfCopy existed long before support for XMP metadata was added and probably it doesn't copy the XMP catalog entry and stream (I'd have to check). I think the best solution would be to use the example in XmpMetadataTest.java where you change the metadata on the lowest level (in CVS there's now a method setData(bytes, false) that will prevent the bytes to be compressed). As for the page sizes, have a look at the following code snippet: Rectangle crop = reader.getCropBox(1); PdfDictionary pagedict = reader.getPageN(2); pagedict.put(PdfName.CROPBOX, new PdfRectangle(crop)); pagedict = reader.getPageN(3); pagedict.put(PdfName.CROPBOX, new PdfRectangle(crop)); You can see this snippet in its context here: http://www.nabble.com/Re%3A-problem-with-adding-text-to-existing-pdf-p16492121.html Bottom line: just like you replaced the data of the XMP stream earlier, you can change the entries in the page dictionary. In the snippet, the Crop box is changed. I think (but I'm not sure) that in your case, you'll have to change the PdfName.MEDIABOX. Unfortunately I don't have the time to adapt the previous example right now, but if you have a problem, please let me know, maybe I'll have some time tomorrow morning. br, Bruno ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar