Question
SINARMASMSIGLIFE
ID
Last activity: 21 Mar 2017 22:20 EDT
pdf viewer and alfresco
Hi,
I need to show the contents of a pdf attachment object in a html when click one of pdf files in the list.
I uploaded pdf files to alfresco 4.2 and using Pega 7.2.1. Based on image below, I can show list of pdf files and using a simple iframe to preview a pdf files hardcoded.
<iframe src = "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/pdf/Installation_Guide/JBoss_Enterprise_Application_Platform-6.4-Installation_Guide-en-US.pdf" width='400' height='500' allowfullscreen webkitallowfullscreen></iframe>
Can you help me with detail explanation how to create pdf viewer that use alfresco as CMIS server?
What is the path for the uploaded files?
Thanks
-
Like (0)
Artsiom Sukhanau Johny Zhang Subbareddy Chaganti Rahul U -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
GB
I can't answer this question directly ; but I can give you some information I found out whilst looking into this - maybe this will be enough to get you started on this - or maybe somebody else can fill in the gaps.
Firstly: this article may be of use - it doesn't deal with CMIS attachments (just standard PRPC attachments) - but it might still shed some light on what needs to be done here :
https://collaborate.pega.com/question/how-create-zip-archive-and-attach-case
In fact in that link above - I previously mentioned that there are different PRPC Classes (Data-WorkAttach-CMIS for instance) used for different types of PRPC attachments: further research shows that this isn't necessarily the case (and the later prhelps miss this section off as well).
It seems that even for CMIS attachments - instances of the 'Data-WorkAttach-File' are created; here are three screenshots - showing me having uploaded an attachment to CMIS (Alfresco Community Edition - using the ATOM connector) via PRPC:
Here's the same document as viewed directly in Afresco:
I can't answer this question directly ; but I can give you some information I found out whilst looking into this - maybe this will be enough to get you started on this - or maybe somebody else can fill in the gaps.
Firstly: this article may be of use - it doesn't deal with CMIS attachments (just standard PRPC attachments) - but it might still shed some light on what needs to be done here :
https://collaborate.pega.com/question/how-create-zip-archive-and-attach-case
In fact in that link above - I previously mentioned that there are different PRPC Classes (Data-WorkAttach-CMIS for instance) used for different types of PRPC attachments: further research shows that this isn't necessarily the case (and the later prhelps miss this section off as well).
It seems that even for CMIS attachments - instances of the 'Data-WorkAttach-File' are created; here are three screenshots - showing me having uploaded an attachment to CMIS (Alfresco Community Edition - using the ATOM connector) via PRPC:
Here's the same document as viewed directly in Afresco:
And back in PRPC - we can see that an Data-WorkAttach-File instance was created for this attachment:
If we take a look at the Page Data for this instance, we can see the CMIS coordinates for this document (amongst other things):
<pzDocumentKey>DATA-WORKATTACH-FILE OBQ6DY-GCS-WORK T-2!20170104T150346.591 GMT</pzDocumentKey>
[...]
<pxAttachKey>20170104T150346.591 GMT</pxAttachKey>
[...]
<pxAttachKey>20170104T150346.591 GMT</pxAttachKey>
[...]
<pyContentLocation>ab918b7d-6a92-4005-a6d8-55e0da31f1ce;1.0</pyContentLocation>
[...]
<pxRefObjectKey>OBQ6DY-GCS-WORK T-2</pxRefObjectKey>
[...]
According to the 'View Definition' of the class DATA-WORKATTACH-FILE the keys for this Class are:
pxRefObjectKey
pxAttachKey
One to reference the work object ; and one to represent the attachment (it seems).
The 'pyContentLocation' appears to be the Alfresco / CMIS repository ID.
If this was a standard PRPC attachment; we would be able to directly download and decode (from 'base64') the content of the 'pyAttachStream' property - but there is an added step needed here, since the content is stored in the CMIS repository.
I ran a TRACER against my Pega7 Portal: and clicked on the download attachment link.
This shows quite a few Activities being fired off - but I think one of the most interest is this one:
CMIS-ServiceData.pyGetContentStream|Pega-Content:07-10-01
I haven't worked out how to use this yet; but (rather nicely) this is well documented on the History Tab of the Activity ; I include this here for completeness:
Call the activity that will perform the CMIS getContentStream API method.
Activity Primary Page:Call this activity using a primary page of a class that extends the CMIS-ServiceData class.
Parameters:
1. CMISEndpoint
This optional parameter is the Service Name key value of the connector rule that will be used for invoking the service. This connector rule instance should belong to the class of the primary page passed to this activity. If this value is not provided on the parameter page, it will be retrieved from CMIS configuration data associated with the user's current application.
2. RequestPage
This required parameter is the name of the page that contains the request data for the CMIS service. The class of the page is specified on the Pages & Classes tab of this activity. Certain property values on the request page are required. Check the pyValidateInputs activity in the class of the request data page to see which property values are required.
3. ResponsePage
This optional parameter is the name of the page that will contain the data returned from the CMIS service after the activity successfully completes. If not specified, the response data will be discarded.
Error Handling:
This activity throws a runtime exception in the event that the required input data is not valid, or the CMIS connector fails when invoked.
Hopefully this might help you start off here - I will try and return to this post if I manage to work out the next steps here.
SINARMASMSIGLIFE
ID
Hi PRITJ,
Thanks for your response, but I got confuse because when I look at Link-Attachment instances, there have Activity with ID pxDownloadCMISFile. At the step 10 and 11 description are "get object data stream from CMIS" and "download file using data stream". At step 11 have 2 variables, PRFileRef and PRFileName. Can I use those variabels and put it to iframe src or you have others method to view the attachment? if it can, how to do it?
Thanks.
SINARMASMSIGLIFE
ID
If anyone could help me?
EPAM Systems, Inc.
ES
Hi,
Have a look :-https://collaborate.pega.com/question/custom-pdf-viewer-pega
Hope it helps you in implementation. Kindly notify if it does, I just search and have got this discussion post.
Regards,
Asif
SINARMASMSIGLIFE
ID
Hi Asif,
It looks can help with part of the problem, if we can get source path for CMIS file and put it. I have tried to got the path base on activity at Link-Attachment, but still failed.
Thanks.
EPAM Systems, Inc.
ES
Hi,
I am not sure, where exactly the path is located.
Though, How about creating a binary file in the Pega environment and then referring it. I am not sure, whether I am going in right direction or not? Please forgive me for that, if I misled based on your requirement.
SINARMASMSIGLIFE
ID
Hi,
Thank you for your response. Can you tell me how to create a binary file? let's say, I upload it in Pega not in alfresco.
Regards
Pegasystems Inc.
GB
@dorkyark: if you mean how do you upload/retrieve a Binary File to/from PRPC (rather than a CMIS repo): some of the notes on this Post can help you (It shows how to download a 'locally' stored Binary File and display in a modal window for instance: to *upload* - that example just using the standard PRPC attach-work-item mechanism): https://collaborate.pega.com/question/how-display-pdf-sectioninvoice
SINARMASMSIGLIFE
ID
Thank you for your help,
It just momentary stop the problem with upload to PRPC and have a warning from our DBA. He didn't want to make our DB become full just from files, so he ask me to upload and view the files to/from different server (storage server) and it's still stuck. I don't know how to make it.
Can you help me with, how to upload and view files to/from different server?
Regards,
Alfian