• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERPDFGeneration and inline images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERPDFGeneration and inline images


  • Subject: Re: ERPDFGeneration and inline images
  • From: Flavio Donadio <email@hidden>
  • Date: Sun, 22 Feb 2015 20:42:40 -0300

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@hidden> wrote:

> Thanks Ray. Answers below.
>
>> On 13 Feb 2015, at 00:21, Ray Kiddy <email@hidden> wrote:
>>
>> On Thu, 12 Feb 2015 13:36:58 +0000
>> Mark Wardle <email@hidden> 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@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: ERPDFGeneration and inline images
      • From: Mark Wardle <email@hidden>
References: 
 >Re: ERPDFGeneration and inline images (From: Ray Kiddy <email@hidden>)

  • Prev by Date: Wonder D2W App Tomcat Deployment
  • Next by Date: Re: ERPDFGeneration and inline images
  • Previous by thread: Re: ERPDFGeneration and inline images
  • Next by thread: Re: ERPDFGeneration and inline images
  • Index(es):
    • Date
    • Thread