We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error generating PDF via grid toolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

143206 Mar 8,2019 07:59 PM UTC Mar 11,2019 11:45 AM UTC Angular - EJ 2 5
loading
Tags: Grid
Fabiano Melo
Asked On March 8, 2019 07:59 PM UTC

I'm trying to insert an image into the PDF file generated by Grid, but the error below appears:

Provided key is not valid. in syncfusion

I'm converting the JPG image to base64 as it should be.

The rest of the PDF works, but if you try to insert the image the error appears.

I have no idea what that might be.

Attached follows the images of the code.



Attachment: images_9fe66d75.rar

Madhu Sudhanan P [Syncfusion]
Replied On March 11, 2019 06:52 AM UTC

Hi Fabiano, 

Thanks for contacting Syncfusion support. 

The reported problem happens when the provided base64 string is not formatted properly or the given image is in format other than JPEG. To troubleshoot this problem, please share the base64 string or the original image to analyze at our end. Also please ensure whether imageHeader variable holds the encoded string value before sending   

Regards, 
Madhu Sudhanan P 


Fabiano Melo
Replied On March 11, 2019 10:20 AM UTC

Hi, thanks for the feedback.

Attached is the image that my function turns into base64 and also a text file with the generated alphanumeric sequence.

A great day at work.

Attachment: base64AndImage_901bb659.rar

Madhu Sudhanan P [Syncfusion]
Replied On March 11, 2019 10:54 AM UTC

Hi Fabiano, 

Thanks for the update. 

When converting the image to data URI, the following string appended which is the cause of the problem. Before providing the encoded string to the PDF export, please strip of the above string as follows to resolve this problem. 


this.imageHeader = dataUrl.slice('data:image/jpeg;base64,'.length); 


Regards, 
Madhu Sudhanan P 


Fabiano Melo
Replied On March 11, 2019 11:33 AM UTC

Many thanks Madhu Sudhanan.

this.imageHeader.replace('data:image/jpeg;base64,','');

Worked perfectly!

Madhu Sudhanan P [Syncfusion]
Replied On March 11, 2019 11:45 AM UTC

Hi Fabiano, 
  
Thanks for the update. 
  
Regards, 
Madhu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;