Hi Avijit, There is an example exists OOTB for the same, Please refer following url
https://demo-stable.ofbiz.apache.org/content/control/EditDataResource?dataResourceId=DR1103b Click on Download link at bottom of page, you will be able to download the pdf file Kind Regards, Deepak Dixit Vice President of Product Engineering mobile: +91 9826754548 email: [email protected] *www.hotwax.co <http://www.hotwax.co/>* On Mon, Jul 18, 2022 at 5:19 PM Avijit Bose <[email protected]> wrote: > Dear Ashish, > > I have taken the 2nd approach. But instead of creating the folder inside > <my app>/webapp folder.... I have created two folders namely 'pdf' and > 'images' inside > "C:\apache-ofbiz-18.12.05\themes\common-theme\webapp\images", and stored > the relative path into the database. By default ofbiz is looking into this > 'images' folder. It worked. > > Also tried by keeping inside the "<my app>/webapp" folder. It worked too. > > Thank you for your help. > Avijit > > On Mon, Jul 18, 2022 at 3:00 PM Ashish Vijaywargiya < > [email protected]> wrote: > > > Hello Avijit, > > > > There can be two options: > > > > 1) If you wish to save images/pdf in the database then please go with the > > option which Nicola suggested in his email. Basically content related > > entities will be involved in this operation: Content, DataResource and > > ImageDataResource. Please review the references in the "content" > component > > present inside the applications folder. > > > > 2) If you wish to keep the images/pdf on the file system then again you > can > > review the upload related functionality in the "content" component. > > There are many examples available in the code. In this case you need to > > create a webapp reference in the ofbiz-component.xml file: > > > > <webapp name="siteresources" > > title="Many Resources" > > server="default-server" > > location="webapp/siteresources" > > mount-point="/siteresources" > > app-bar-display="false"/> > > > > Then inside webapp folder: > > - webapp > > -- siteresources > > --- images > > --- pdf > > > > You can create your media contents inside the "siteresources" folder. In > > the Form Widget you can use following code: > > > > <field name="myImage"><image value=" > > http://localhost:8080/siteresources/images/ofbiz_logo.png" > > style="cssImgXLarge"/></field> > > <field name="myPdf"> > > <hyperlink description="Default PDF" target-type="plain" target=" > > http://localhost:8080/siteresources/pdf/pdftest.pdf" > > target-window="_BLANK"/> > > </field> > > > > You can dynamically prepare the data inside groovy files for image->value > > attribute and for hyperlink->target attribute and use it in the form > widget > > field tag. > > > > Hope this helps! > > > > -- > > Kind Regards, > > Ashish Vijaywargiya > > Vice President of Operations > > *HotWax Systems* > > *Enterprise open source experts* > > http://www.hotwaxsystems.com > > > > > > > > On Mon, Jul 18, 2022 at 9:11 AM Avijit Bose <[email protected]> > wrote: > > > > > Dear Sir, > > > > > > I have a link in the form as shown below: > > > -------------------------- > > > <field name="salaryCertificateUrl" > use-when="${salaryCertificateUrl!='Not > > > Applicable'}" title="${uiLabelMap.salaryCertificate}" > > widget-style="text"> > > > <hyperlink target="salaryCertificateUrl" > > > description="${salaryCertificateUrl}" also-hidden="false" size="25"> > > > <parameter param-name="salaryCertificateUrl"/> > > > </hyperlink> > > > </field> > > > -------------------------- > > > > > > Note: "salaryCertificateUrl" is a path of a pdf file. I DON'T WANT TO > > > GENERATE PDF FILE. JUST WANT TO VIEW PRE_GENERATED PDFs. I am uploading > > it > > > and then wants to view it from the link in my form. Same this for > images. > > > > > > Pls let me know how do I view this. > > > > > > regards > > > Avijit > > > > > >
