0

URL から PDF を取得し、BASE64 文字列を返すには、次のタスクがあります。

私が現在持っているもの (申し訳ありませんが、私は Java の専門家ではありません):

public String readPDFSOAP(String var, Container container) throws StreamTransformationException{
try {
        //get the url page from the arguments array
        URL url = new URL("URLPDF");
        try {
            //get input Stream from URL
                            InputStream in = new BufferedInputStream(url.openStream());
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            byte[] buf = new byte[131072];
            int n = 0;
            while (-1 != (n = in.read(buf))) {
                out.write(buf, 0, n);
            }
            out.close();
            in.close();
            byte[] response = out.toByteArray();
                            String string = new String(response);
            
        } catch (Exception e) {
            e.printStackTrace();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }return String;}

しかし、文字列を返すことはできません。どんな助けでも大歓迎です。

ありがとう、ジュリアン

4

2 に答える 2