The Clown is cool but i got some problem on it

Here it is:

My job is change PDF to XML , It's mean add some mark on it

  the PDF is:
        Title one
    The Clown is cool,
    The Clown is good.
and i want to change the PDF to:

      <title>Title one</title>
      <row>The Clown is cool,</row>
      <row>The Clown is good.</row>
in that PDF all Title hava a bookmark

So i thought maybe i can

1` open the PDF
2` Get the bookmark
3` Use the bookmark to locale the line
4` just use some code like  String s = "<title>"+x.readline()+"</title>"

My Code is:

    public static Document readPDF(String url) throws IOException{
        File file;;
            file = new File(url);
            return file.getDocument();
        catch(FileFormatException e){System.out.println("This is not the PDF format"); }
        catch(Exception e)
        {System.out.println("error 1");}
        return null;
    public static void writeIO(Document document){   
        Page page = document.getBookmarks().get(0).getDestination().getPage();

Now i don't know how to change the page and readline on it,

I check the API, Is the toInlineObject fun can do this ?
(Sorry My English is so bad that i can't read allmost the API)

but I don't really know what "PrimitiveFilter context" it is .

and I want know is the code like:

IOutputStream stream;
page.toInlineObject(PrimitiveFilter context).writeTo(stream)
stream.write(IInputStream data)

can do what i wanted to do?

Thanke you soooooooooooo  much.