I have a pdf component published with a dynamic component template. I need some guidelines how to fetch this published PDF by using Content delivery API's

//create a new BinaryMetaFactory instance:
BinaryMetaFactory binaryMetaFactory = new BinaryMetaFactory();
//find the metadata for the specified binary
BinaryMeta binaryMeta = binaryMetaFactory.GetBinaryMeta("tcm:1-123");
//print the path to the output stream:
if(binaryMeta!=null) {
    Response.Write("Path of the binary: " + binaryMeta.UrlPath);
//Dispose the BinaryMetaFactory

I have used this code in my page template TBB, but its displaying a blank page. Did I miss anything?

1 Answer 1


I have a few questions to frame the solution...

  1. You're publishing the binary from Tridion... why not get the URL at publish time?
  2. You say "I have used this code in my page template TBB". What is the published result?

Now for possible solutions...

Publish a link to the binary

In your template, you can use <a tridion:href="@@Component.ID@@" tridion:type="Multimedia">Click here to download my pdf</a> to output a link to a binary.

Use the linking API to find a binary

BinaryLink link = new BinaryLink(publicationId);
string url = link.GetLink("tcm:28-123", "", "", "", "", true).Url;

That method's signature includes a lot of parameters you don't need if all you want is the URL (text for the link, anchor, etc). Intellisense is your friend there.

  • I tried this code,getting the path of the pdf as a static text,link is not resolving.I have added default finish action in the page template.Ned to add any specific TBB for resoving links for binaries
    – roop
    Apr 17, 2013 at 8:41
  • "link is not resolving" -> Looks like it's not published? Yes, you should always use the Default Finish Actions.
    – Nuno Linhares
    Apr 17, 2013 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.