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

Exporting PDF to database from WinRT (XAML) app

Thread ID:





110208 Jul 24,2013 05:12 PM UTC Sep 6,2013 11:43 AM UTC WinForms 5
Tags: PDF
Khurram Bhatti
Asked On July 24, 2013 05:12 PM UTC


We are trying to save pdf form to the database. So far we can successfully save the file to the desktop and view it. We are able to send it back to the database (SharePoint 2013) but when we try to open it, it throws an exception stating that the file is corrupt. My guess is that it converts the PDF to utf-8 before sending it to the database (we are using REST). Is there a way to store the pdf to SharePoint without messing it up?

George Livingston [Syncfusion]
Replied On July 25, 2013 12:07 PM UTC

Hi Khurram,

Thank you for using Syncfusion Products.

Can you please provide us the issue reproducing sample along with the corrupted PDF document. It would be more helpful for us to investigate on this.

Please let us know if you have any concerns.



Khurram Bhatti
Replied On September 3, 2013 01:30 PM UTC

My apologies for the delayed response. I didn't know that there is no automated message generated when someone responds to a post. Attached is the code that we are working on to store a PDF on SharePoint. The PDF gets generated correctly and can be saved to the desktop without any issue but when it is transferred to SharePoint, it becomes corrupt. Not sure if utf-8 encoding has anything to do with it or not.


George Livingston [Syncfusion]
Replied On September 4, 2013 12:01 PM UTC

Hi Khurram,


Thank you for your update.


On further analysis, we found that the issue is not due to the Syncfusion library. The PDF document contains content streams which is in encoded format, while converting the PDF document to string (UTF8/Unicode) the content streams gets corrupted. This causes the problem in opening the PDF document in Adobe Reader.


Please let us know if you need any further assistance.




Khurram Bhatti
Replied On September 5, 2013 10:56 AM UTC

Thank you very much George for your kind help in this. How can we avoid that conversion of PDF into Unicode? Is it a limitation of the Windows 8 SDK?

George Livingston [Syncfusion]
Replied On September 6, 2013 11:43 AM UTC

Hi Khurram,


We regret for the inconvenience caused.


On further analysis, we have found that this behaviour can be overcome by the using ToBase64String to encode the PDF byte[] to string and FromBase64String to decode string to PDF byte[] in the destination. On saving the byte[] in the destination the PDF document can be opened without any error in the Adobe Reader.


string encodedPdfData = Convert.ToBase64String(pdfByteArray);

byte[] decodedPdfData = Convert.FromBase64String(encodedPdfData);


Please let us know if you need any further assistance.





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