danwatford commented on a change in pull request #252:
URL: https://github.com/apache/ofbiz-framework/pull/252#discussion_r561058042



##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,12 +136,22 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
+    GenericValue partyContent = 
PartyContentWrapper.getFirstPartyContentByType(partyId, partyGroup, 
"LGOIMGURL", delegator)

Review comment:
       Hi @dixitdeepak , 
   After manually setting DataResource.mimeTypeId to null I was able to call:
   ```
   PartyContentWrapper.getPartyContentAsText(partyGroup, 
content.getString("contentId"), context.request, "html")
   ```
   and get a String in response of the form `%EF%BF%BDPNG%0D%0A%1A...` which 
looks like a textual representation of the PNG file contents that I could then 
appropriately convert to base64 and include as a data-uri which is then 
consumed by Apache FOP.
   
   However, to do this we had to manually amend a database record which was 
created as a result of uploading party content via the UI. It is not clear to 
me how where the problem is. 
   
   Is there an issue with how content is handled when uploaded to ofbiz?
   Is there an issue which how content is rendered to text? Do we need a way to 
tell PartyContentRenderer/DataResourceWorker that we wish to render a binary 
file as a base64 encoded string? I'm not really familiar with the content 
handling mechanisms in ofbiz so am not able to advise a direction at the moment.
   
   It seems these issues might take a while to resolve. Meanwhile this PR is a 
workaround to get company logos displayed correctly in PDF documents and I 
would rather not delay the workaround unless there is a problem with its 
implementation.
   
   Would you object to me merging the PR as is?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to