Without writer.setViewerPreferences(PdfWriter.PageModeUseOutlines) you shouldn't have the bookmark pane.
Paulo ----- Original Message ----- From: "Patrick O. Thurman" <[EMAIL PROTECTED]> To: "'Post all your questions about iText here'" <[email protected]> Sent: Tuesday, October 31, 2006 7:53 PM Subject: [iText-questions] How do I get rid of the Book Marks window? >I have a java class that reads a text file and then creates a PDF file >>From the text version. I do NOT want to use book marks, but when the > Adobe reader opens my PDF it also opens the book marks window. How do I > get > rid of the book marks window? I know in the Adobe reader you can just > close > the window, but the users do not want to do that, they want me to > eliminate > the window during creatation. > > This is a portion of the java class that does the work: > > > /** > * generates the output PDF file in the out dir > * > * @param srcFile complete DOS path and filename of input file > * @param targetFile complete DOS path and filename of output PDF file > */ > private boolean genPDF(String srcFile, String targetFile) { > String line = null; > Document document = null; > BufferedReader in = null; > String outLineItem = null; > if (ORIENTATION.equalsIgnoreCase("landscape")) > document = new Document(MEDIA.rotate(), rm, lm, tm, bm); > if (ORIENTATION.equalsIgnoreCase("portrait")) > document = new Document(MEDIA, rm, lm, tm, bm); > try { > in = new BufferedReader(new FileReader(srcFile)); > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream(targetFile)); > // if (!outLineText.equalsIgnoreCase("none")) > writer.setViewerPreferences(PdfWriter.PageModeUseOutlines); > document.open(); > // step 4: we grab the ContentByte and do some stuff with it > PdfContentByte cb = writer.getDirectContent(); > // > // we create a PdfTemplate > PdfTemplate template = cb.createTemplate(25, 25); > if (createCoverPage) { > genCoverPage(document, srcFile, writer, cb); > } > int cnt = 0; > try { > while ((line = in.readLine()) != null) { > try { > if ((line.indexOf(tmpTOPid.toString()) >= 0)){ > document.newPage(); > cnt=0; > } > // make outline by account number > if > (!outLineText.equalsIgnoreCase("none")) { > if (line.indexOf(outLineText) >= 0) > { > if (line.length() < eIdx) > eIdx = line.length(); > outLineItem = line.substring(bIdx,eIdx); > PdfDestination d1 = new PdfDestination(PdfDestination.FIT); > // we define the outlines > PdfOutline out1 = new PdfOutline(cb.getRootOutline(), d1, > outLineItem); > // depreciated not needed any more > // cb.addOutline(out1); > } > } > if ((cnt == lineNoBM)&&(lineNoBM != 0)) { > outLineItem = line.substring(bIdx,eIdx); > PdfDestination d1 = new PdfDestination(PdfDestination.FIT); > // we define the outlines > PdfOutline out1 = new PdfOutline(cb.getRootOutline(), d1, > outLineItem); > // depreciated not needed any more > // cb.addOutline(out1); > } > if ((fontWork)&&(line.indexOf("<")) >= 0){ > getFonts(); > doFontWork(document, line, fontDefFont, fontUnderFont, > fontItalicFont, fontBoldFont, fontAltFont); > } > else > // document.add(new Paragraph(12, line, fontDefFont)); > document.add(new Paragraph(11, line, fontDefFont)); > } > catch (com.lowagie.text.DocumentException e) { > System.out.println("111111 " + e); > } > cnt++; > } //end of while loop > in.close(); > document.close(); > } > catch (IOException e) { > System.out.println("222222 " + e); > } > } > catch (com.lowagie.text.DocumentException e) { > System.out.println("333333 " + e); > } > catch (FileNotFoundException e) { > System.out.println("444444444 " + e); > } > return true; > } > > > Pat > > > Patrick O. Thurman > Stephen F. Austin State University > Information Technology Services > Data Base Administrator > Phone: (936) 468-1074 > Fax: (936) 468-1117 > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
