I have some Multimedia Components which contain uploaded binary files of multimedia types PDF and MS Word.
Is it possible to read the content of the PDF/DOC from the Multimedia Component using the TOM.NET API?
I have some Multimedia Components which contain uploaded binary files of multimedia types PDF and MS Word.
Is it possible to read the content of the PDF/DOC from the Multimedia Component using the TOM.NET API?
You can get the bytes of the document/image/... that was uploaded to the multimedia component. I believe you can get it using this code
// MMComp contains the multimedia component - you can get this via a call to the GetObject(tcmuri) function
if (MMComp.BinaryContent != null)
{
var bytes = MMComp.BinaryContent.GetByteArray();
}
Now, you have the bytes of the uploaded file. Depending on what your application has to do, you'll have to save it as an appropriate file (you can't treat the bytes of a pdf file as it were a png file, or vice versa).
sing the property MMComp.BinaryContent.Filename, you should be able to retrieve the file name of the original uploaded file, and find out if the original file is a pdf, png, gif, or whatever other file type you allow in your Multimedia Schema.