java.io.IOException: The document has no pages.

ZK-Tracker | hawk | 2 years ago
  1. 0

    h2. Steps to reproduce # load a blank xlsx file # export it as a PDF like {code} File file = new File(currentFoler+ss.getBook().getBookName()+".pdf"); System.out.println(file.getAbsolutePath()); FileOutputStream fos = new FileOutputStream(file); //shall get exporter for each exporting Exporters.getExporter("pdf").export(ss.getBook(), fos); Filedownload.save(file, "application/excel"); {code} h3. Actual Result {quote} ExceptionConverter: java.io.IOException: The document has no pages. at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:272) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at bsh.Reflect.invokeMethod(Unknown Source) at bsh.Reflect.invokeObjectMethod(Unknown Source) at bsh.BSHPrimarySuffix.doName(Unknown Source) at bsh.BSHPrimarySuffix.doSuffix(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHBlock.evalBlock(Unknown Source) at bsh.BSHBlock.eval(Unknown Source) at bsh.BshMethod.invokeImpl(Unknown Source) at bsh.BshMethod.invoke(Unknown Source) at bsh.BshMethod.invoke(Unknown Source) at bsh.Name.invokeLocalMethod(Unknown Source) at bsh.Name.invokeMethod(Unknown Source) at bsh.BSHMethodInvocation.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:133) at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328) at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:900) {quote} h3. Expected result a friendly message "Spreadsheet find nothing to print" or just export one blank page.

    ZK-Tracker | 2 years ago | hawk
    java.io.IOException: The document has no pages.
  2. 0

    h2. Steps to reproduce # load a blank xlsx file # export it as a PDF like {code} File file = new File(currentFoler+ss.getBook().getBookName()+".pdf"); System.out.println(file.getAbsolutePath()); FileOutputStream fos = new FileOutputStream(file); //shall get exporter for each exporting Exporters.getExporter("pdf").export(ss.getBook(), fos); Filedownload.save(file, "application/excel"); {code} h3. Actual Result {quote} ExceptionConverter: java.io.IOException: The document has no pages. at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:272) at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at bsh.Reflect.invokeMethod(Unknown Source) at bsh.Reflect.invokeObjectMethod(Unknown Source) at bsh.BSHPrimarySuffix.doName(Unknown Source) at bsh.BSHPrimarySuffix.doSuffix(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHBlock.evalBlock(Unknown Source) at bsh.BSHBlock.eval(Unknown Source) at bsh.BshMethod.invokeImpl(Unknown Source) at bsh.BshMethod.invoke(Unknown Source) at bsh.BshMethod.invoke(Unknown Source) at bsh.Name.invokeLocalMethod(Unknown Source) at bsh.Name.invokeMethod(Unknown Source) at bsh.BSHMethodInvocation.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at bsh.Interpreter.eval(Unknown Source) at org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:133) at org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328) at org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:900) {quote} h3. Expected result a friendly message "Spreadsheet find nothing to print" or just export one blank page.

    ZK-Tracker | 2 years ago | hawk
    java.io.IOException: The document has no pages.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    ExceptionConverter: java.io.IOException: The document has no pages. am using iText

    Stack Overflow | 5 years ago | Arun
    java.io.IOException: The document has no pages.
  5. 0

    java.io.IOException: The document has no pages

    Stack Overflow | 4 years ago | Ritesh Mehandiratta
    java.io.IOException: The document has no pages.

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      The document has no pages.

      at com.lowagie.text.pdf.PdfPages.writePageTree()
    2. iText-4.2.1
      Document.close
      1. com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source)
      2. com.lowagie.text.pdf.PdfWriter.close(Unknown Source)
      3. com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
      4. com.lowagie.text.Document.close(Unknown Source)
      4 frames
    3. org.zkoss.zss
      ExporterImpl.export
      1. org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:272)
      2. org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49)
      2 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. BeanShell
      Interpreter.eval
      1. bsh.Reflect.invokeMethod(Unknown Source)
      2. bsh.Reflect.invokeObjectMethod(Unknown Source)
      3. bsh.BSHPrimarySuffix.doName(Unknown Source)
      4. bsh.BSHPrimarySuffix.doSuffix(Unknown Source)
      5. bsh.BSHPrimaryExpression.eval(Unknown Source)
      6. bsh.BSHPrimaryExpression.eval(Unknown Source)
      7. bsh.BSHBlock.evalBlock(Unknown Source)
      8. bsh.BSHBlock.eval(Unknown Source)
      9. bsh.BshMethod.invokeImpl(Unknown Source)
      10. bsh.BshMethod.invoke(Unknown Source)
      11. bsh.BshMethod.invoke(Unknown Source)
      12. bsh.Name.invokeLocalMethod(Unknown Source)
      13. bsh.Name.invokeMethod(Unknown Source)
      14. bsh.BSHMethodInvocation.eval(Unknown Source)
      15. bsh.BSHPrimaryExpression.eval(Unknown Source)
      16. bsh.BSHPrimaryExpression.eval(Unknown Source)
      17. bsh.Interpreter.eval(Unknown Source)
      18. bsh.Interpreter.eval(Unknown Source)
      18 frames
    6. ZK Kernel
      PageImpl.interpret
      1. org.zkoss.zk.scripting.bsh.BSHInterpreter.exec(BSHInterpreter.java:133)
      2. org.zkoss.zk.scripting.util.GenericInterpreter.interpret(GenericInterpreter.java:328)
      3. org.zkoss.zk.ui.impl.PageImpl.interpret(PageImpl.java:900)
      3 frames