getting the below error while exporting to PDF file:-
java.io.FileNotFoundException: D:\Workspace\PricingTool\data.properties (The device is not ready)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at export.ExportToPdf$PageNumbersWatermark.onOpenDocument(ExportToPdf.java:1451)
at com.lowagie.text.pdf.PdfDocument.initPage(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.open(Unknown Source)
at com.lowagie.text.Document.open(Unknown Source)
at export.ExportToPdf.CreatePDF(ExportToPdf.java:189)
at export.ExportToPdf.doGet(ExportToPdf.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
这是我的代码:
public void CreatePDF(Document document, PdfWriter writer,
HttpServletRequest request) throws DocumentException {
otherexpids = new ArrayList();
int proj_id = Integer.parseInt(request.getParameter("proj_id"));
int ver_id = Integer.parseInt(request.getParameter("ver_id"));
document.addAuthor("Infogain Corporation");
document.addTitle("Online Pricing");
writer.setPageEvent(new PageNumbersWatermark());
writer.setEncryption(null, "pc123!".getBytes(),
PdfWriter.AllowPrinting, PdfWriter.STANDARD_ENCRYPTION_128);
document.open();
Paragraph ph = new Paragraph("", header);
ph.setAlignment("center");
document.add(ph);
我想将一些记录导出到pdf文件但是在调试时我遇到错误 document.open()
请帮我解决这个问题。提前致谢
答案 0 :(得分:0)
如果在配置文件中配置了路径,请检查位置。就我而言,我将驱动器从E更改为D