on 11-01-2018 8:25 AM
Hello Experts,
My Scenario is file to IDOC where in I receive PDF file as an Input, Convert it to XML and map to target IDOC fields. I have used java mapping with the below code.
public class TestReadPDF extends AbstractTransformation
{
public void transform(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException
{
try
{
String msgType = "MT_DUMMY";
String nameSpace = "http://dumy_poc_purchaseorders";
String str;
String str1;
String str2;
str="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ "<ns0:"+msgType+" "+"xmlns:ns0=\""+nameSpace+"\">";
str = str + "\n<Record>";
PdfReader reader = new PdfReader(inputstream);
PdfTextExtractor pdf = new PdfTextExtractor(reader);
str1 = pdf.getTextFromPage(1);
str2 = pdf.getTextFromPage(2);
str= str1+str2+"\n</Record>"+"\n</ns0:MT_DUMMY>";
byte by[] = str.getBytes(); outputstream.write(by);
reader.close();
outputstream.close();
}
catch(Exception e)
{ e.printStackTrace();
}
}
@Override
public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException
{
// TODO Auto-generated method stub
}
}
Unfortunately I am receiving the empty output after mapping.
Kindly help on the same.
Thanks in advance for help!!
Regards,
Prashanth Bharadwaj.Ch
Hi Evgeniy,
could you please help me on a high level design of the similar problem.
We have customers they are sending us purchase orders in PDF format. We are using SAP ECC system and looking for a solution based on SAP PO/PI to convert PDF to XML and to send this as an IDOC from PO to ECC. We also using Adobe Document Services Server to create and to send PDF-files via Email. Is it possible to create XML files from PDF using PO and ADS? Could you please describe possible way (high level) .
Thank you in advance.
Dmitri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy,
Thank you so much for your kindly reply.
I will work on it and update on the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prashanth!
@Override
public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException
{
this.transform(in.getInputPayload().getInputStream(), out.getOutputPayload().getOutputStream());
}
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.