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=, 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

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.