Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


PDFBOX.net PDDocument Object into a database / serialization


I hope some can shed some light on this. It looks like I need to recompile PDFBOX with the [SERIALIZE] option. But I have no idea how to.

What I am trying to do is store PDDocument doc object inside a database.

ERROR: Type 'org.apache.pdfbox.pdmodel.PDDocument' in Assembly 'PDFBox, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

    PDDocument doc = (PDDocument)documents.get(d);

    string str = ConvertForWrite(doc);

    /// Convert any object into a string which can be store in a database
    public  string ConvertForWrite(object obj)
    {
        MemoryStream memoryStream = new MemoryStream();
        BinaryFormatter binaryFormatter = new BinaryFormatter();
        binaryFormatter.Serialize(memoryStream, obj);
        string str = System.Convert.ToBase64String(memoryStream.ToArray());
        return str;
    }

asked Apr 28, 2015 in Database(DBMS) by rajesh
0 votes
31 views



Related Hot Questions



Government Jobs Opening


...