Use data uri scheme for company logo in PDF headers (OFBIZ-7327)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Use data uri scheme for company logo in PDF headers (OFBIZ-7327)

Daniel Watford
Hello,

I'd like to propose using the data uri scheme for images used in documents
generated using Apache FOP.

Issue https://issues.apache.org/jira/browse/OFBIZ-7327 highlights the
problem of displaying company logos in documents such as invoices, making
it difficult for administrators to customise the documents generated by
ofbiz.

The cause of the problem appears to be that ofbiz now defaults to using
HTTPS, but URLs, created to access content uploaded to ofbiz will use HTTP.
Ofbiz responds to these content requests with a 301 Redirect which is not
handled by Apache FOP when resolving URLs.

One solution might be to ensure Apache FOP is configured with certificate
authority information, meaning it can access resources using the HTTPS
scheme, but this might be difficult to handle in cases involving localhost
or behind reverse-proxyies.

I suggest using the data-uri scheme (https://tools.ietf.org/html/rfc2397)
to embed the data describing content, such as logo images, directly in the
XML processed by Apache FOP.

PR https://github.com/apache/ofbiz-framework/pull/252 has implemented this
change, but I could do with others testing it out and making sure it
doesn't interfere with other ofbiz uses involving content, such as
ecommerce.

I have tested with company logos up to 800KB without error.

To test with demo data, please use PartyMgr to upload a Logo Image for the
Company party as party content (
https://localhost:8443/partymgr/control/viewprofile?partyId=Company)

Then open invoice id 8010 (
https://localhost:8443/accounting/control/invoiceOverview?invoiceId=8010)
and click the PDF button to generate an invoice.

Please let me know if you run into any problems or have any concerns about
using data-uris in this way.

Thanks,

Dan.

--
Daniel Watford