Reputation: 1517
I am using itext to create a pdf. As a final result i am downloading a zip file.After extracting it i am having directory structure as follows:-
main dir
|
|_ evidence_dir/abc.pdf
|
|_xyz.pdf
i am using this code to create the link in pdf
chunk = new Chunk( "Link" ).setAction(PdfAction.gotoRemotePage("evidence_dir/abc.pdf", "6", false, true ));
this code is for file xyz.pdf. I am getting the link create but when clicking on the link current pdf getting closed and then nothing happened.
Can anybody please help me.
Thanks, Manish
Upvotes: 0
Views: 607
Reputation: 77606
I've create a small standalone example that shows how to create a RemoteGoto in a PDF using iText. You can download the ZIP with the resulting PDFs here. It works for me, can you check if it works for you?
Several things aren't clear from your question.
"6"
present as a named destination in your abc.pdf
? (I created an abc.pdf
file with a destination named "dest"
)"6"
a named destination defined by a PDF string? (cf. your false
parameter)true
parameter)Update:
In your comment, you say that "6"
should be a number, but in your code, you use a string. It's normal that that doesn't work, strings aren't numbers. Please take a look at the RemoteGoToPage example to see how it's done.
Update 2
In one of the comments, I'm asked if you can link to a specific word in an existing PDF from an HTML-link. That's a completely different question. You can do this using Open Parameters. On page 7 of this spec, you can find more info about the search
parameter:
Opens the Search UI and performs a search for the specified word list in the document. Matching words are highlighted in the document.
Upvotes: 1