1

i have this binarystring in this format:

%PDF-1.3
%âãÏÓ
7 0 obj
<</Linearized 1/L 7945/O 9/E 3524/N 1/T 7656/H [ 451 137]>>
endobj

13 0 obj
<</DecodeParms<</Columns 4/Predictor 12>>/Filter/FlateDecode/ID[<4DC91A1875A6D707AEC203BB021C93A0><F6C92B368A8A13408457A1D395A37EB9>]/Index[7 21]/Info 6 0 R/Length 52/Prev 7657/Root 8 0 R/Size 28/Type/XRef/W[1 2 1]>>stream
hÞbbd``b`² ±H0§ 6G ñå#Ã4,#¹ÄÆ_L¤ð
endstream
endobj
startxref
0
%%EOF

27 0 obj
<</Filter/FlateDecode/I 69/Length 58/S 38>>stream
hÞb```a``üÏÜ6¨¬$ËѬ,ÆÅ
ÜÜÓt&¬8ÌZ-R,¿â
endstream
endobj
8 0 obj
<</Metadata 1 0 R/Pages 5 0 R/Type/Catalog>>
endobj
9 0 obj
<</Contents 11 0 R/CropBox[0 0 595 842]/MediaBox[0 0 595 842]/Parent 5 0 R/Resources 14 0 R/Rotate 0/Type/Page>>
endobj
10 0 obj
<</Filter/FlateDecode/First 94/Length 773/N 13/Type/ObjStm>>stream
hÞ¼TmoÚ0þ+þàØq"UHÐ}®ÒZ¡&[?DùBW£ÿ~w  .µ+¥ÒÆÌùåî|¾ç¹ã0Âá~&Ü'"¬"&~Æç0`FTÈÆà$ &gZá­æDH°b!à(°Æ$¹¸ UQÕÑ&:\4
/cä~4¢ß¶ö:²"ÅëÆãõÝÁ´*-ìMÆ[4}ÐM%ÞÞM}¼¸:xgg>««ydlBgWS:­MG£^fÅýõ¯ÊÖë,C?ÆôP¦ô6³u¾MØPrt>=~Ò¸Ò\A^ØóP ÜB
CÅTJV¹5³*/mÒmxá!DBÑÜ<eEcht9¦Æ÷ôfaJ:Û¿lÌ>?£è_åOO¦6åÜ4    §ÏEalºS,çÕ"/­Þ$k&F/ëǪx=DX1UÑó£E#´ä4®~9(ÂwIÅ3´o:9DDB¦ :ï&_®,aôÊtûÁ9ٲƴVIµM>Ðgài$Ì`2HÛÓ»lmè¸Î³b0©`ÅmLolVäóq¹,ø¬Yÿ*zû0ðª:ߨª>|Ý÷Fúã²É_×Ó¼nìå*«]|{wHl|ðl§Á¹¿ONýlb¥Ö\/ìªIFJ~íkiò*}ÎßÐñ}ý¡¥üÖº/»¥î/[-ÏóÒ>ÀAÈߨwËÀÊG¬"¬±S0¦{ÇùÚ4wæ÷}µÎÊYôÊìcRÿvtЭå)@«ÃdCcÚÚѦVíÿO&Aíf{¨}uÐ;ÈB)ßа«Ø¡ÄÈp}£O
ÃíãØ½¨ z'»¸#ÿëÓ>K¿Ôe|$ÊÐÓÇ]æ|ê9óóç4Nj,x-É0è¤Ô]IrÁ|Ì x¿$Û¾Ùeæ(E®>Ó&ÿé÷¼Ü©£büRbݧè©=÷}Ì\qºÿ®¨û1îô`
Ñ£9bWÒ@Æ?>Ð`ñ
endstream
endobj
11 0 obj
<</Filter/FlateDecode/Length 1530>>stream
H0´WKoã6F¯þs[ªÆ½Çt·)ÐÓb+ !n²Ä$*dÑé¤ùSýi{-
,ZPøræ:"oÆ?t:Û®Ë &îaqR@2ÊÒ<®«¤º¬q~äÐí7·ïm   åc  ØasûÓ/)<ÚÍ60$« 64ªè^6¿©»(MâLѶ}Sev¢mJCÜhâZ
Ñ6Sk´­â
w{?ÜÃýDaµ~ï~&¯c&
fдq:rYç"(Ç:$­×!£ë0â»ÁG³º~7kø`P!$nÕpÜëÅÁ}TƹÂEZ[÷¸"£¨Ëg&Úðæç&Kª'ª!ã2=ëÕö³,<L3Y"áȬ{ãU÷F!"Ro"¶z}ö/ë(Ão¸q~Ù̶iSÐ}`ÆÒ¶"b¢aÆï×Q ñDÖÍâìÍå<Jð»òܬ`Õ³RsÓm[ôË#¹§Q7|E>!¢³9`´å-^FxU"~&±Q¢ÀȽ^Q/Á½ÊSb²Å:EÊ[1"IQÒT_ƺu´-qÏkÝÓ,÷}¢±ÆYÆaÚ}I#þpܧ¡wY GÃsïÈ0p´¬F¦ôÎÀ°j   Ñß*Ó0¹8ø,9sï²ÂðqR"P+ØNÇEf#_Zò¥¥aÅsB¢hèÙøÜ[Í2
C"áÅð8Y·N»£ÜbQ?0¤Ùk+W& Ô'PjQü°Ì½Ü:eæZòf"½°Zܶæ¸8Í]F/{"MVÏK
À©axz2S>WÓòÑeßí½g²a$Y+RH}uPúWþP\TÜþx"ÆpWHÒVµ%ßs·¼aEß __~4zS=« ^ÜaI½p
(0 ÇÌA#°HOѶÁ@#¯f`
Rán&*ÈÆI"£Äø¢   !~¡Àâ@ü0¦ýRb N&ù°ú&qÃ$`¼¶¬+¹±Æ¦>´Ó¤©DáOaµëù;FN4^1;
s¤}Ò¯MÄ{:LrdáãN"ÆdLQt¾Äó
O
ß §ör¹hâdbÁbTÊÊäp*/q¥ÞEÜUCÈò¥~ð¥vúò¢#²^=2`9µ¸è«éð #F³¼Ã`Eðá©î&(0àÌ~(õ,2Ç?Q  SÓ¶¢´µWI¬úßÜÅ×ò@Bc dRMR{\¨´>¡°(/.*Ï"rQ?¿ô¯\øà°NHD/¦h0ZWÍ3YsóëU5ÇDj/ò.ÉNøûÌËT[QE&¡Æ¿3    QãÅQ?9#Ä?õ5½ß9â¿Ä6ôiݦЦm}t7q1ªÚ~ÿ""/È )áñeÔ
z(}ÕçË­kxPëðåäq.µú³ÞâS]á4oC!DI!£lè¹Aqz¤Ò+í9lÞa{gß,ù~ Ê.Ö.îC¬ypd+    ­L½£0
4ù"¾L½*¤òíÚ7ü¬ov°4giƬõë"PòeD%]Ùl¨Y    Íg'Õ¤JI­^RÙX,¦GM)º³-,¶HÛæ
ºjÛÒìS*>Rx1
Ü3ö6fÆõ´`Zp¢dj@¾B6ÜMó䯯ÕÿÉÛ³a¾AËùéAüIwRVnË?é~-ÑJ½°?×3~äv"Fn4/Ëlú»*0,¬¡»Sá¯`üdDAôÔÆ 0î.Yú*ysõDOtA&ºaÛD³°ª±%ýw ¿"]s°hß>½7ìIRø¿N~SS:ÁIñT8sO¾é©½¦ñ*y,`÷²:û+Ëa)e*<¥Ê&ÿCF}R§Í£Á_yý´¿iô>:dÝ÷UÆá¨}¤p}_D]F &]c¯4üK¤]heÝíéQxçs«¡àWúîÄ?v:¿­!Ý

endstream
endobj
12 0 obj
<</Filter/FlateDecode/Length 208>>stream
H0T½Â0÷>&GCÚÎUX:ð#
ìiâVƹéз')ÄKöåÓ-öÍ¡!@\Ø©ô 4ãè&V  (AÖn©ÊJ"Âí<´
õª*×(}gØ´³íÜsoASY#`s+î8h'ïxhäP× ±ÏÄþ(ýIZRò`.ób5tG/²¤¡Ê9ú]ô¿ö!ºþÝþ¾Ve^u0à´É×[MÌ1Ö²î(e0ß9xçezÙK¬CÈi?

endstream
endobj
1 0 obj
<</Length 3656/Subtype/XML/Type/Metadata>>stream
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04        ">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description rdf:about=""
            xmlns:dc="http://purl.org/dc/elements/1.1/">
         <dc:format>application/pdf</dc:format>
         <dc:creator>
            <rdf:Seq>
               <rdf:li>cdaily</rdf:li>
            </rdf:Seq>
         </dc:creator>
         <dc:title>
            <rdf:Alt>
               <rdf:li xml:lang="x-default">This is a test PDF file</rdf:li>
            </rdf:Alt>
         </dc:title>
      </rdf:Description>
      <rdf:Description rdf:about=""
            xmlns:xmp="http://ns.adobe.com/xap/1.0/">
         <xmp:CreateDate>2000-06-29T10:21:08+11:00</xmp:CreateDate>
         <xmp:CreatorTool>Microsoft Word 8.0</xmp:CreatorTool>
         <xmp:ModifyDate>2013-10-28T15:24:13-04:00</xmp:ModifyDate>
         <xmp:MetadataDate>2013-10-28T15:24:13-04:00</xmp:MetadataDate>
      </rdf:Description>
      <rdf:Description rdf:about=""
            xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
         <pdf:Producer>Acrobat Distiller 4.0 for Windows</pdf:Producer>
      </rdf:Description>
      <rdf:Description rdf:about=""
            xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">
         <xmpMM:DocumentID>uuid:0805e221-80a8-459e-a522-635ed5c1e2e6</xmpMM:DocumentID>
         <xmpMM:InstanceID>uuid:62d6ae6d-43c4-472d-9b28-7c4add8f9e46</xmpMM:InstanceID>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>





















<?xpacket end="w"?>
endstream
endobj
2 0 obj
<</Filter/FlateDecode/First 4/Length 48/N 1/Type/ObjStm>>stream
hÞ2U0P°±ÑwÎ/Í+Q0Ô÷ÎL)}¶`Åê!T¤ê$¦§ÛÙÖw¬
endstream
endobj
3 0 obj
<</Filter/FlateDecode/First 4/Length 167/N 1/Type/ObjStm>>stream
hÞ<ËÁ
Â0EÑ_"
¢Ä*UJ¡XÜ    .×±Ié@è@2Eü{`»|çMSv9L9ÁY
oU~£·B<÷V|ÑxæÌQ£ÑX¯µ^!®~¯¬®4DN<
<8:¨·¨Ê+»?Ö»k½7"Þm°úâ[d·>]ÆO+ÐS
ÁG¨¶#GxÐìø"Ty'  ¾¸O gA|¸õ)xÕ¶gg;d
endstream
endobj
4 0 obj
<</DecodeParms<</Columns 3/Predictor 12>>/Filter/FlateDecode/ID[<4DC91A1875A6D707AEC203BB021C93A0><F6C92B368A8A13408457A1D395A37EB9>]/Info 6 0 R/Length 37/Root 8 0 R/Size 7/Type/XRef/W[1 2 0]>>stream
hÞbb```bä=ÂÄÀ?"0¡!0&0ñ±$Í`*Y
endstream
endobj
startxref
116
%%EOF

and i would like to convert it to base64. However i am not able to use btoa(BINARYSTRING) to convert, not sure why. Is there any way i could convert it? i have tried many different methods including btoa(unescape(BINARYSTRING)) and btoa(unescape(encodeURIComponent(BINARYSTRING))). both doesnt seem to give a encoded base64 result back.

1 Answer 1

3

However i am not able to use btoa(BINARYSTRING) to convert, not sure why. Is there any way i could convert it

Yes this is the correct way to encode it. Make sure typeof BINARSTRING === 'string'. If not call toString on it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.