Content Management and Capture

Content Management and Capture

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  HTML to PDF Conversion and store the pdf in FileNet.

    Posted Thu November 10, 2022 01:22 PM
    Requirement: send the data from coach to the html code and prepare a templet and convert the html code with data to "PDF" file (.pdf extension) and convert(encode) the PDF file into "Base 64" and create a document and store it in the FileNet. 

    I am stuck at the conversion of html code to pdf. Need help.

    Thank you in advance.

    ------------------------------
    Chakradhar Simhadri
    ------------------------------


  • 2.  RE: HTML to PDF Conversion and store the pdf in FileNet.

    Posted Fri November 11, 2022 07:45 AM
    PDF Conversion is usually handled server-side and semi-asynchronously b/c it has a large number of dependencies on fonts and other factors to produce consistently rendered pages.

    My usual approach is to write an event action to handle it on the FileNet side where you'd commit the HTML as is to FileNet and use an Event Subscription to do the file conversion and store the PDF as version 2 of the same document. Then on future retrievals you request current version and get back the PDF. You can then use retention policies and a deletion sweep to clean up the html versions if desired.

    While you can embed the PDF Convert logic using pdfbox or itext or any other java compatible library in the event action code module, I usually find performance benefits from externalizing this function to a separate microservice that is invoked by the event action logic.

    Alternatively Content Navigator and Daeja ViewONE, included with the product, also have built-in capabilities to do PDF Conversion, both use server-side logic to do it and put up a progress bar when done interactively from the UI, because it can be slow. Both services are using OutsideIn and PDFBox to do it.

    ------------------------------
    Eric Walk
    Director

    O: 617-453-9983 | NASDAQ: PRFT | Perficient.com
    ------------------------------



  • 3.  RE: HTML to PDF Conversion and store the pdf in FileNet.

    Posted Wed November 16, 2022 12:02 PM
    I would ask the question around the document itself.  What are you saving it as a document for?  Do you only need the data from the screen itself, if so, store it as XML as that is all that is needed?  Are you trying to format the data elements in HTML, to make them easier to read vs XML?  I would ask, for what purpose are you storing this data as?  Transaction record of what happened?  If so, I would say store as XML and present it in the UI as needed.  Add in and XSL to format it when displayed.  Also, if it is just data elements, then create a business object, add the data elements.  Upon retrieval, you can display that.

    If the intent is to create a document, think more like a mail merge concept of old.  I have this set of data elements to create a piece of correspondence to be sent.  That is very different and Eric's suggestion helped set that up.  Launch a process to generate the PDF or Word document and email it out.  This provides a re-usable task for other such activities.  Eric's suggestion helps use FileNet to keep track of the history of the document as well, as v1 is just the core data elements, and v2 is the finished document.  My only difference is to create full workflow task vs an event subscription.

    This all depends on what type of document you are creating and for what purpose.  Good news there are a few options.

    ------------------------------
    Mike Prentice
    ------------------------------



  • 4.  RE: HTML to PDF Conversion and store the pdf in FileNet.

    Posted Wed November 16, 2022 12:33 PM
    It's a good call out @Mike Prentice, I took the need for the PDF as a given, but we do need to start asking that question "is a PDF even needed here?" more often. And yes, workflow is another great approach here.

    This also reminded me that our friends at Adobe have actually started coming out with some cloud APIs for the mail-merge use-case enabling on demand PDF generation given a JSON Schema, a JSON with data, and a .docx file that's been properly templated out. Could reduce some overhead and be an easier integration for workflow or event actions (maybe a webhooks approach, idk). Automate Document Generation | Contract Generation - Adobe Developers



    ------------------------------
    Eric Walk
    Director

    O: 617-453-9983 | NASDAQ: PRFT | Perficient.com
    ------------------------------