I am getting the following error:
Could not invoke the service() method on servlet clearview. Exception thrown
: org.springframework.web.util.NestedServletException: Request processing
failed; nested exception is ExceptionConverter: java.io.IOException: The
document has no pages.
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:762)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3146)
at
com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:250)
at
com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:212)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1958)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:112)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
Caused by: ExceptionConverter: java.io.IOException: The document has no
pages.
When I try to execute the following code:
PdfReader reader = new PdfReader(pdfFileName);
document = new Document();
writer = PdfWriter.getInstance(document, bos);
document.open();
cb = writer.getDirectContent();
document.newPage();
int page = 1;
PdfImportedPage page1 = writer.getImportedPage(reader, page);
cb.addTemplate(page1, 1.015f, 0, 0, 1.06f, -13, 0);
bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
cb.beginText();
cb.setFontAndSize(bf, 8);
cb.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Iron Maiden", 580,
830, 0);
cb.endText();
writer.close();
document.close();
Could anyone shed light on what I am doing wrong?
Thanks
Will
--
View this message in context:
http://www.nabble.com/The-document-has-no-pages.-tp21080269p21080269.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php