I have it to work in Umbraco7 - Cant install the pacakage in Umbraco 7, so i had to install it manually
Unzip the pacakae
Upload the Flexit.PdfThumbnails.dll, GhostscriptSharp.dll , gsdll32.dll, gsdll64.dll
Add the reference
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using Flexit.PdfThumbnails
@*
Macro Parameters To Create, for this macro to work:
Alias:mediaId Name:Media Folder ID Type:Single Media Picker
*@
@if (Model.MacroParameters["mediaId"] != null)
{
@* Get the media folder as a dynamic node *@
var mediaFolder = Umbraco.Media(Model.MacroParameters["mediaId"]);
if (mediaFolder.Children.Any())
{
<ul>
@* for each item in children of the selected media folder *@
@foreach (var mediaItem in mediaFolder.Children)
{
int mediaID = mediaItem.Id;
var pdf = PDFHelper.GetMedia(mediaID);
<li>
<h5><a href="@mediaItem.umbracoFile">@mediaItem.Name</a></h5>
@foreach (var thumb in pdf.PdfThumbs)
{
<a target="_blank" href="@pdf.Media.Url"><img height="200" src="@thumb.fileName" [email protected]""></a>
}
}
</li>
}
</ul>
}
}
@using Flexit.PdfThumbnails
int pdfId = Convert.ToInt32(CurrentPage.pdfProperty);
var pdf = PDFHelper.GetMedia(pdfId);
foreach (var thumb in pdf.PdfThumbs.Take(1)){
@thumb.fileName
}
If not - Try saving your PDF-file in the media archive.
PDF Thumbnails - Umbraco7
Hi
I have it to work in Umbraco7 - Cant install the pacakage in Umbraco 7, so i had to install it manually
If this helps anyone
René
I honestly want this to work, but it doesn't.
I upload the dlls, and then create this on "partial View Macro Files", but nothing happens. It's broken in some way.
If you (or anybody else) could help, it would be greatly appreciated.
:-)
This solution will also work in Umbraco 7.3.0
Funny, it doesn't work for me. When I call the new GetMedia extension I can see that there is no 'pdfThumbnails' node in the XML
I expect the DLL's to be uploaded to BIN folder ?
Just for info
I can see the folder in the media folder /media/1921/pdfthumbnails
And just for kicks, it would be nice if you could tell it what page to convert to PDF. That way you don't fill the server with unused JPGs
This should work:
If not - Try saving your PDF-file in the media archive.
Hi
New information to help out here.
Just testet on Umbraco version 7.4.2
Install this: https://our.umbraco.org/projects/pdf-preview/
Add a media picker to a doc type
Add the macro to a template.
Example template:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = null; var pdfId = Model.Content.GetPropertyValue("pDF"); var pdfUrl = Umbraco.TypedMedia(pdfId).Url; }
Index PDF
@Umbraco.RenderMacro("PdfPreview", new {LinkURL=pdfUrl, MediaId=pdfId, PageNum="1", QualityDPI="18"})
Result:
is working on a reply...