Convert text into PDF

前端 未结 4 1472
轮回少年
轮回少年 2021-01-26 05:08

I have a huge string of text that is apparently raw data for a PDF file, and I need to make it back into a PDF.

Currently I\'m reading the string into a StringBuffer but

4条回答
  •  说谎
    说谎 (楼主)
    2021-01-26 05:40

    Okay, well after a lot of research I found out that to preserve the binary data in the string that typically you convert it to Base64 encoding. On a complete guess I decoded the string out of Base64 and dropped the bytes into the pdf file, and lo and behold I had a pdf that could be opened!

    Thanks for the answers and I hope this helps someone in the future!

提交回复
热议问题