To Whom It May Concern:
I am currently developing a web application that uses Spring
Framework and iText to take in values (through a series of forms) and generate
a PDF from them.
I want the PDF to have specific margins (90, 90, 72, 50).
I have a PDF.java class with the following method in it:
protected void buildPdfDocument(Map model, Document
document, PdfWriter writer, HttpServletRequest request, HttpServletResponse
response) throws Exception
{
…
}
I would use the simple “document.setMargins();” method,
but it only takes effect on the second page, and I need the given margins used
for the entire output.
In the tutorial examples, the first page margins are set
with the constructor “new Document(PageSize.A5, 36, 72, 108, 180),”
and then “setMargins()” is used for the subsequent pages.
Because of the Spring setup, my Document is actually passed as a parameter, so
I never really create it myself. I did try re-initializing the Document
using the aforementioned constructor, but Tomcat would suddenly tell me that “document”
had no pages (I tried both re-opening and never opening the Document after
re-initialization—neither eliminated the error).
Is there another method that will set the current page’s
margins? Or, is there any other way I can affect Spring’s creation
of the Document—maybe by altering Spring or iText defaults?
Thanks.
___________________________
IT Intern
T 617.674.6330
M 860.967.6178
mmccall@endeca.com
Endeca
www.endeca.com
find / analyze / understand