Hi,
I am facing one problem while creating PDF using life cycle designer tool.
I am trying to generate a PDF that will contain a simple textInput with some text. I am using a snapshot class to capture this component.
This captured image is converted to base64 using base64Encoder.Now, this encoded string creates a problem with lifeCycle Designer..
If I enter,say 7, in textInput, the PDF gets generated properly with a complete snaphot of text box and the text within. But if I enter some other text, say XXDD, the PDF generation fails. Is there any problem with decoding the base64 encoded string?
Here is some code snippet :
On printing the value of the node <imageField> gives me data like:
iVBORw0KGgoAAAANSUhEUgAAAN4AAAA4CAYAAACSekYo.// this is Base64 encoded string. For this case the PDF generation is successful, but if the string contains some spaces in between, the PDF generation fails.
Please suggest!
Views
Replies
Total Likes
Hi All,
The problem has been resolved.
One learning: Never use the GET request method when passing the such huge data.
//Flex code
**********************************Instead of*****************************************
var url:String = "/pdfSampleApp";
var snapshot:ImageSnapshot = ImageSnapshot.captureImage(uname);// uname is a textInput
containerImage = ImageSnapshot.encodeImageAsBase64(snapshot);
url = url + "/PDFGeneratorServlet?xmlData="+xmlImageModel";
navigateToURL(new URLRequest(url), "_New");
********************************Use*****************************************************
var req : URLRequest = new URLRequest(url)
var params : URLVariables = new URLVariables();
params.xmlData = xmlImageModel;
params.type = type;
req.data = params;
req.method = URLRequestMethod.POST;
navigateToURL(req,"_New");
Rest remains the same!
Cheers!
Views
Replies
Total Likes