I am able to get a PDF file from an URL, encoding the stream into base 64 and send the string to a third party within a field of a XML file, but I have the next issue when I try to open the PDF file decode.
Cannot extract the embedded font 'ArialMT,Bold". Some characters may not display or print correctly.
Here is the code from Java Mapping in SAP PI 7.1:
urlStr = "Insert here your url";
StringBuffer data = new StringBuffer();
URL url = new URL(urlStr);
URLConnection conn = url.openConnection ();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
String carriagereturn = System.getProperty("line.separator");
while ((line = rd.readLine()) != null)
{
trace.addWarning(line);
sb.append(line);
sb.append(carriagereturn);
}
rd.close();
result = sb.toString();
} catch (Exception e){
trace.addWarning(e.toString());
}
return org.apache.commons.codec.binary.Base64.encodeBase64String(result.getBytes());
I have read that it is not possible to retrieve the font when you execute an InputStreamReader
because of the copyrights of the letter. Is it true?
Is there other any possibility to embed the font afterwards using iText library or similar?