cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Metadata as the Content

mildsteel
Champ in-the-making
Champ in-the-making
Hello, we are implementing a form that users can fill and review before submitting it for approval. I have been playing with the Alfresco Model Designer (https://addons.alfresco.com/addons/alfresco-model-designer). I have created the customer metadata model for my form. Essentially all my form fields are either types or aspects in my custom model.

Now, I am planning to implement the following :

- User clicks on create content and selects the custom model - A pdf document is displayed which has all the metadata properties (values are not populated)
- User clicks on edit properties, populates the fields (which are either type properties or aspect properties ) and hits save
- User views all the updated values in the pdf

Basically, the custom metadata is the Content in this case. Has anyone had experience in doing something like this ? If so, could you explain how you achieved this?

Thank you in advance

Regards
ms
4 REPLIES 4

rjohnson
Star Contributor
Star Contributor
I have done this in 2 different ways, which you choose is likely to depend on whether or not your users need to print your documents.

Following exactly your scenario above, you need to create document template (HTML, ODT or XSL-FO or MS Word if you run on Windows server) and a rule that is executed "on create" or "on update". The rule does a transform using your document metadata and your template. The template can be in any format you like, but what I did was to make it an HTML template (because it was easier to create) and then after the transform, do a rendition to PDF. This works but the drawback is that the HTML templates don't "dispaly in browser" well to A4 for printing. Whilst you can do the PDF render from the HTML (which does go to A4) the render chain (HTML -> OpenOffice -> PDF) has a tendency to be inaccurate especially about tables with borders.

We have done exactly the same but using a XSL-FO template (and an associated custom transform) which works beautifully but the XSL-FO templates are hard to create and there seems to be only 1 open souce graphical designer (which has not been updated since 2008) and commercial XSL-FO template designers are very expensive. We did it by hand as the template was not that complex and not that likely to change.

We have also done it using an OpenOffice template. This to works well but requires a small amount of Java programming.

If you don't need to print, then in my opinion the very best way to do what you need is as follows:-

<ul>
<li>Create a new mimetype that represents "metadata only documents".</li>
<li>Create a special web preview extension that uses an FTL template to format the metadata in your document for display in the web preview pane.</li>
</ul>

This sounds like a lot of work but isn't, its supremely flexible, you can display diffrent data dependent upon user / user role and its only downside is that you don't get printable output (which you could do by adding a transform / render and making it invisible).

mildsteel
Champ in-the-making
Champ in-the-making
Thank you Bob, that was very helpful

ms

juilee
Champ in-the-making
Champ in-the-making
Thanks a lot Bob, I too have to do the same thing - convert metadata to either HTML or PDF. How can I show an image that has been included as relevant document in one of the metadata fields. Can it be shown too in the HTML page?

rjohnson
Star Contributor
Star Contributor
Yes. Assuming you are using the "metadata only" ftl display method then you can read the documents metadata and you can use the noderef that is in the metadata to get the image just as if you would get the image from any other website in any other HTML page.

If you are trying to go to print (PDF) its more complicated but what you do is set up your FTL to create an print document in HTML and then transform that to PDF. Now, you will need to create a custom transform because Open Office isn't that great at transforming HTML -> PDF and tends to miss images. By contrast wkhtmltopdf is great and there is lots of doc and examples around as to how to create a custom transformer with it.