AnsweredAssumed Answered

Previews for PDF Forms

Question asked by chrisokelly on Aug 7, 2012
Hi Alfrescoers,

As some have no doubt noticed already, Dynamic PDF's do not get a proper preview, rather a plaintext message: "Please Wait… If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document". I know that this is less an artefact of Alfresco than it is of Adobe - the message is shown because the PDF is opened not by reader but by PDFBox (as far as I have been able to find out so far).

We use PDF Forms fairly heavily in Alfresco and my manager has asked if I can override this message, instead displaying something along the lines of "This PDF cannot be previewed, please click 'Download' or 'View in Browser' to view this form". My first thought was that I would be able to define this page somewhere in the creation of the form in LiveCycle, however my efforts in the Adobe forums to this end have been fruitless. As far as I can tell Adobe does not provide the tools to override this page.

I was thinking maybe I could modify the service which generates the previews. If I transform the pdf to a text file I get the same message, so I figure I can transform and copy to a temporary file, check the content to see if it is one of these type of PDFs, and, if so, get the preview from another document and use that. I just need a little help in where I would implement this. I spent the morning tracking my way through the Java files in the SDK looking for the right class to change but I am a little hampered by the fact this is my second ever contact with Java (my first was yesterday). I have mainly been looking in the rendition service and the action executors, but I am feeling more and more babe-in-the-woods-like as I go on.

Can anyone suggest in which java package/class the preview is generated? As far as I can tell, I want one or both of two locations:
  • Where the method/class is called which will generate the preview and return (I assume) it's Noderef

  • Where the cm:doclib association is created