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. Image for the cookie policy date

Loading stream into PDFLoadedDocument. Unexpected type error

Hi there,

I'm using the PDF component to load a stream from the database (SQL Server 2008). The stream in the database is stored as binary data type. Each stream has different contents and represent different file types e.g. .pdf, .doc, .jpg, .xls

I wrote a function to load the stream into a new PDF object.

==
Dim pdf As New Syncfusion.Pdf.Parsing.PdfLoadedDocument(strm)
pdf.Save("C:\lab\output.pdf")

pdf.Close()
pdf = Nothing
==

On the first line above, it would fail to load most time citing "Invalid/Unknown/Unsupported format". I noticed that when I loaded a stream that was a PDF file type, it would save. Any other types like .doc, .xls or .jpg, it would not save.

Can you please confirm if the stream is supposed to be a PDF type?

Is there any way I can 'convert' the stream to a PDF type so I can save it as a PDF?

Thanks.
John


2 Replies

JO John Owens July 20, 2011 10:18 AM UTC

Hi there,

I found the ExcelToPDF among your components. I was using a different namespace.

I've changed the code to check what file types are being returned so I can either save a PDF file directly or convert it first.

It works! Thanks.

John



GM Geetha M Syncfusion Team July 21, 2011 08:36 AM UTC

Hi John,

Thank you for your interest in Syncfusion products.

Glad to hear that you problem has been resolved.

Please let me know if you have any questions.

Regards,
Geetha


Loader.
Live Chat Icon For mobile
Up arrow icon