Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] PDF's With Varied Page Sizes

John Donkenstein

2006-07-18

Replies:

I am attempting to generate a PDF (based on an existing PDF) which may
contain various
page sizes (standard i.e. A4, US LETTER, etc and non-standard). I am
currently using a
Document with a PDF Writer in the generation and was under the impression
that the
following would achieve the results I desire:

Document document = new Document(PageSize.LETTER, 0, 0, 0, 0);
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream(pdfFile));
for(each page being generated) {
//A CUSTOM SIZE FOR THE NEXT PAGE WHICH MAY VARY FROM LETTER
Rectangle psize = new Rectangle(x, y, w, h);
document.setPageSize(psize);
document.newPage();

//CODE TO CONSTRUCT THE PAGE...
}

When I debug the document page size is that of the Rectangle I specify,
however
the page size reported by writer.getPageSize() is PageSize.LETTER.

In reading some of the lists it seems like I may need to set the media box
size, but I can not
find anything in the APIs which seems to allow this (or more specifically to
allow this via the writer).
Any insight as to how to achieve the varied page sizes will be greatly
appreciated.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.