1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Converting Progress 4GL blob file to pdf in c#

Discussão em 'StackOverflow' iniciado por fdantas, Janeiro 24, 2020.

  1. fdantas

    fdantas Administrator Moderador

    I've got a simple webservice developed in Progress 4GL from which I receive as output parameter a dataset with a blob in whoich I have stored a pdf file.

    DEFINE TEMP-TABLE TTDocument NO-UNDO
    FIELD DocSeqNr AS INT
    FIELD FileName AS CHAR
    FIELD EventCode AS CHAR
    FIELD EventDescr AS CHAR
    FIELD FileContent AS BLOB
    .


    DEFINE DATASET ds FOR TTDocument.

    DEFINE INPUT PARAMETER pCoCd AS CHARACTER NO-UNDO.
    DEFINE INPUT PARAMETER pLanCd AS CHARACTER NO-UNDO.
    DEFINE INPUT PARAMETER pUsrCd AS CHARACTER NO-UNDO.
    DEFINE INPUT PARAMETER pFilter AS CHARACTER NO-UNDO.
    DEFINE OUTPUT PARAMETER DATASET FOR ds.
    DEFINE OUTPUT PARAMETER pErrorTxt AS CHARACTER NO-UNDO.


    In .Net I make a request to this web service and I handle the response like this :

    XmlElement doc;
    DataSet xxx = new DataSet();
    beaHostDB.GetDocumets(pCoCd, lanCd, pUsrCd,idAdd, out doc, out pErrorTxt);
    XmlElementToXmlDocment(doc);
    var reader = new StringReader(doc.InnerXml);
    xxx.ReadXml(reader);
    foreach (DataRow dr in xxx.Tables[0].Rows)
    {
    DcumentList.Add(new Document { FileContent =dr["FileContent"].ToString});
    }


    So now I have a string with the binary representation of this pdf file.

    How can I convert this string to bytes[] to get this pdf file in c#?

    Continue reading...

Compartilhe esta Página