java - Problems while using relative path in order to make a link to another file -


I am trying to write a program that will file a PDF with the link using iText, the following code Snippet is the program:

  Private Chapter Generated PDF (string text, string path) {Phrase phrase = new phrase (text); Paragraph paragraph = new paragraph (); Paragraph.add (phrase); Chapter chapter = new chapter (paragraph, 1); Chapter.setNumberDepth (0); Chuck test = null; String name = path.svg substring (path.lastIndexOf ("\\") + 1, path.length ()); {Test = new part (i + "." + Name) for (int i = 1; i & lt; 3; i ++); Trial.setAnchor (path); Paragraph para = new paragraph (); Para.add (test); Chapter.add (paragraph); } Return Chapter; }  

holds the value of the name of the file text in the above method and is the absolute path in the path , but only for a file The relative path must be used.

> You have been using Java 7:

 < Code> final string filename = path. Gate (path) .getFileName (). ToString ();  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -