Convert pdf file received in string variable to byte array in C# -
i trying develop application in c# takes data service1(3rd party), processes , sends data service2(again 3rd party).
the data trying receive, process , send pdf file
from service1, receiving pdf file in string variable.
e.g.
response.content = "%pdf-1.4 \n1 0 obj\n<<\n/pages 2 0 r\n/type /catalog\n>>\nendobj\n2 0 obj\n<<\n/type /pages\n/kids [ 3 0 r 17 0 r ]\n/count 2\n>>\nendobj\n3 0 obj\n<<\n/type /page\n/parent 2 0 r\n/resources <<\n/xobject << /im0 8 0 r >>\n/procset 6 0 r >>\n/mediabox [0 0 ..." now, service2 requires pdf data in byte[] form
how convert response.content i.e. string byte[]?
fyi -
i have tried below method, didn't work. able open file shows junk values.
byte[] bitmapdata = encoding.utf8.getbytes(response.content); update : solved
i found not service1 sending data in string format, it's using irestresponse.content, string variable restsharp instead of using irestresponse.rawbytes, byte[] variable.
i found not service1 sending data in string format, it's using irestresponse.content, string variable restsharp instead of using irestresponse.rawbytes, byte[] variable.
Comments
Post a Comment