Hi.
I am creating a link to an attachment in my Java macro.
Is it possible to add an URL fragment (like #page=3) to an attachment link?
I would like to do something like this:
XWikiAttachment attachment = sourceDocument.getAttachment("sample.pdf);
String ref = entityReferenceSerializer.serialize(attachment.getReference());
AttachmentResourceReference resource = new AttachmentResourceReference(ref);
resource.setParameter("anchor","page=3");
return List.of(new LinkBlock(List.of(new WordBlock("Show")), resource, false));
However, this approach did not work.
I tried adding the anchor parameter to an attachment link in wiki syntax like this:
//Does work
[[MyLink>>doc:MySpace.MyPage.WebHome||queryString="param1=val1" anchor="test"]]
//Does not work
[[attach:sample.pdf||target="_blank" anchor="test"]]
I am assuming this means an attachment link does not support the parameters queryString and anchor, while other types of links (like a DocumentResourceReference) do support these parameters.
Is there another possibility to add an URL fragment to an attachment link?