I have pdf files i want to know how can i upload it and use it as we upload a image and when we click it, it displays so i want the same functionality for this pdf files also, when i click on the link it opens the pdf file in new window. so can any one guide me through this.
so you mean to say as i upload the image with the syntax like below string catalogImage1Url = "";
if (Umbraco.AssignedContentItem.HasValue("catalogImage1"))
{
catalogImage1Url = Umbraco.AssignedContentItem.GetPropertyValue<IPublishedContent>("catalogImage1").Url;
}
and accessing the image with below line <img src="@catalogImage1Url" alt=""/>
i can do the same with the pdf's also just have to upload the pdf file in media section?
upload the pdf file in umbraco
I have pdf files i want to know how can i upload it and use it as we upload a image and when we click it, it displays so i want the same functionality for this pdf files also, when i click on the link it opens the pdf file in new window. so can any one guide me through this.
Hi Ishan
There is no difference between images and pdg for rendering.
Just upload pdf file to Media library and render it the same way as an image.
Alex
so you mean to say as i upload the image with the syntax like below
string catalogImage1Url = ""; if (Umbraco.AssignedContentItem.HasValue("catalogImage1")) { catalogImage1Url = Umbraco.AssignedContentItem.GetPropertyValue<IPublishedContent>("catalogImage1").Url; }
and accessing the image with below line<img src="@catalogImage1Url" alt=""/>
i can do the same with the pdf's also just have to upload the pdf file in media section?
Yes, but you have to render pdf file as a link to download, tag is only for images.
Alex sir, can you please elaborate it can you please give me a example of it, like syntax how can to render the pdf file as a link.
As Alex says, you can't render a PDF file in an image tag. Currently you are doing this:
You should be doing this, for PDF files:
Thank you Søren Mastrup sir & Alex Skrypnyk sir it worked out for me.Thanks for the immediate response!!
is working on a reply...