Convert DOCX to PDF and show in document view

Hi,

I have a requirement to read uploaded DOCX file from appian uploads folder convert it to PDF and show in document viewer on richtext icon click. I have been able to convert DOCX file to PDF but not able to show it in document viewer.

Please help.

  Discussion posts and replies are publicly visible

  • Hi ,

    Could you please share the error that you're facing?

  • I am not facing any error, I just don't know how to achieve it.

  • 0
    Certified Lead Developer
    in reply to shamima0001

    I hope this documentation helps you. Just pass your documentId for the document parameter.

    docs.appian.com/.../Document_Viewer_Component.html

  • I know how to show PDF file in document viewer. My requirement is to get DOCX file convert it and show it document viewer on the fly, Below is the Interface & Process Model

    Interface

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    a!localVariables(
    local!file,
    {
    a!fileUploadField(
    label: "File Upload",
    labelPosition: "ABOVE",
    target: cons!TCT_UPLOAD_FILES_FOLD,
    value: local!file,
    saveInto:local!file,
    required: true,
    validations: {}
    ),
    a!buttonArrayLayout(
    buttons: {
    a!buttonWidget(
    label: "Upload",
    icon: "upload",
    saveInto: {
    a!save(ri!file,local!file)
    },
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Process Model

  • 0
    Certified Lead Developer
    in reply to shamima0001

    Oh okay, got confused with your reply.

    You can have another User Input task after the PDF conversion node and show the document inside that form. Since the path is activity chained, after clicking on upload, the process will convert the document and show it in the next interface where the user lands.

  • I have implemented what you mentioned above, now instead of viewing PDF file in document viewer its downloading DOCX file when I am running PM.

    UserInput

  • 0
    Certified Lead Developer
    in reply to shamima0001

    You need to save the (new) Doc ID of the converted PDF into a PV, and pass that value into your user input task's interface.  I'm not sure what you're intending to do in the screenshot above, but what we can see is not enough.

  • 0
    Certified Lead Developer
    in reply to shamima0001

    , As mike said, you need to pass the converted PDF file into the form. Also, the data type of the rule input should be a 'document' type.

  • 0
    Certified Senior Developer

    I got the same issue. cannot see the docx document in the document viewer and insted of showing document getting downloaded

  • 0
    Certified Senior Developer
    in reply to thiliniumesha

      that's the expected behavior, you can't preview a docx you must convert it to PDF to show it with the document viewer.

    As to why a docx can't be previewed, it has to do with the browser -> community.appian.com/.../preview-docx-doc-xls-etc-in-browser

1 2