N
N
Nick Smith2014-03-06 19:21:49
Java
Nick Smith, 2014-03-06 19:21:49

How to get pdf file as string?

Tell me, is it possible to save a pdf file in a String? This string needs to be transferred and saved back to the pdf.

byte[] data = Files.readAllBytes(Paths.get(PDF));
            String contentStream = new String(data);
            PrintWriter writer = new PrintWriter(new File(PDF1), "UTF-8");
            writer.write(contentStream);
            writer.close();

The white sheet is kept all the time.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mars2003, 2014-03-06
@Braidner

If you do not need to change the contents of the PDF, but simply transfer it as a string and then restore it, then you can convert it to base64

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question