Mark,

I am afraid Mr. Donald Duck is going to die... One of the most terrible 
diagnoses I've ever seen... ;)


Cheers,
Flavio

On 13/02/2015, at 05:03, Mark Wardle <[email protected]> wrote:

> Thanks Ray. Answers below.
> 
>> On 13 Feb 2015, at 00:21, Ray Kiddy <[email protected]> wrote:
>> 
>> On Thu, 12 Feb 2015 13:36:58 +0000
>> Mark Wardle <[email protected]> wrote:
>> 
>>> I struggled to use dynamically generated images in ERPDFGeneration
>>> and couldn’t get it to work - generally getting incorrect URLs in the
>>> generated HTML files generated from a WOComponent template.
>> 
>> What kind of URLs were you trying to use? Were you trying to use
>> relative URLs to get a component-generated image in the app? I would
>> have tried a direct action and non-relative URLs. Did you try that and
>> did it not work?
>> 
> 
> Yes initially relative URLs. Then I created a DA but that didn’t work either 
> with odd wr resource URLs generated that had _NO_FRAMEWORK__NO_FILENAME in 
> the raw HTML generated from the WOComponent. Plus, putting that logic in a DA 
> felt odd as it separated the functionality and caused me anguish regarding 
> security.
> 
>>> 
>>> As a fix, I added support for ERPDFGeneration to handle html IMG tags
>>> with base64 encoded data in the SRC attribute.
>>> 
>> 
>> It sounds as though you believe you have settled for this solution, but
>> this seems to be the best way to do this. Putting data into a img
>> tag in this manner has been a great solution for me several times. Would
>> the dynamic images you are generating be re-used or are they actually
>> dynamic every time? Or are you tiling them together from something
>> that has stored?
> 
> The dynamic images are dynamically generated charts from JFreeChart based on 
> patient data. I wanted them embedded in patient letters generated from the 
> software (see attached). 
> 
> 
> <2015-02-11-14032-procedure-958.pdf>
> 
>> 
>> It is not ERPDFGeneration-specific but it is possible that Wonder's
>> support for dynamically generated graphics could be better. Or, as is
>> more likely, there is probably more than one way to do this in Wonder
>> and it is probably not clear which is better. What did you use for
>> generating your images?
> 
> Using JFreeChart and then included them in a WOComponent used to create a 
> “report” (patient letter) using this:
> 
> RSDEmbeddedImage.java
> public class RSDEmbeddedImage extends ERXStatelessComponent {
>       private String _mimeType;
>       private NSData _data;
>       public RSDEmbeddedImage(WOContext context) {
>               super(context);
>       }
>       @Override
>       public void reset() {
>               super.reset();
>               _mimeType = null;
>               _data = null;
>       }
> 
>       public String mimeType() {
>               if (_mimeType == null) {
>                       _mimeType = valueForStringBinding("mimeType", 
> "image/jpeg");
>               }
>               return _mimeType;
>       }
>       public NSData data() {
>               if (_data == null) {
>                       _data = (NSData) valueForBinding("data");
>               }
>               return _data;
>       }
> 
>       public String imageSource() {
>               StringBuilder sb = new StringBuilder();
>               sb.append("data:");
>               sb.append(mimeType());
>               sb.append(";base64,");
>               NSData data = data();
>               if (data != null) {
>                       sb.append(Base64.encodeBase64String(data.bytes()));
>               }
>               return sb.toString();
>       }
> }
> 
> RSDEmbeddedImage.HTML:
> <webobject name="Image”/>
> 
> RSDEmbddedImage.WOD:
> Image: WOImage {
>       src = imageSource;
>       alt = ^alt;
>       border = ^border;
>       class = ^class;
>       id = ^id;
>       style = ^style;
> }
> 
> I couldn’t find an equivalent in Wonder and I could’t get WOImage to work 
> with a data tag. I probably misconfigured the conversion from WOComponent 
> into HTML in some way but this seems a simply way of fixing things.
> 
>> 
>> cheers - ray
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org
>> 
>> This email sent to [email protected]
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/flavio%40donadio.com.br
> 
> This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to