Encode a PDF into base64 xml

Hi Pal,
There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file.
I have heard that this could be done in the PI layer, using the Conversion Agent.
Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64. howvere, I am unaware of how to convert PDF to binary.
Could someone guide me thorugh this please?
Thanks,
Preethi.

To convert a spool into a binary table, take a look here:
http://wiki.sdn.sap.com/wiki/display/Snippets/Convert%20Smartform%20to%20PDF%20format?bc=true
I've done a similar scenario, and i've developed the conversion on Abap side, with cl_http_utility=>encode_base64 method into an xstring field.
In your case, there's the Adobe I Form, than you need to save PDF file in a system's directory, you need to read the generated file, encode, and than send out.
You can also use Conversion Agent, and do the conversion in PI system.

Similar Messages

  • Re: Encode THAI Language into BASE64 Format

    Hi  Guru's,
            Have a requirement  to encode particular IDOC text fields which are in  THAI language to BASE64 format . We are able to encode the same for english but not able to do the same for Thai language so can any one help with the coding to create custom UDF  which can convert.
    Regards
    Sathish Kumar K.C

    Hi ,
       Please find below my code...
    public class Base64a {
    //     Mapping table from 6-bit nibbles to Base64 characters.
    private static char[]    map1 = new char[64];
         static {
            int i=0;
            for (char c='A'; c<='Z'; c+) map1[i+] = c;
            for (char c='a'; c<='z'; c+) map1[i+] = c;
            for (char c='0'; c<='9'; c+) map1[i+] = c;
            map1[i+] = ''; map1[i++] = '/'; }
    //     Mapping table from Base64 characters to 6-bit nibbles.
    private static byte[]    map2 = new byte[128];
         static {
            for (int i=0; i<map2.length; i++) map2<i> = -1;
            for (int i=0; i<64; i++) map2[map1<i>] = (byte)i; }
    Encodes a string into Base64 format.
    No blanks or line breaks are inserted.
    @param s  a String to be encoded.
    @return   A String with the Base64 encoded data.
    public static String encode (String s) {
         return new String(encode(s.getBytes())); }
    Encodes a byte array into Base64 format.
    No blanks or line breaks are inserted.
    @param in  an array containing the data bytes to be encoded.
    @return    A character array with the Base64 encoded data.
    public static char[] encode (byte[] in) {
         int iLen = in.length;
         int oDataLen = (iLen*4+2)/3;       // output length without padding
         int oLen = ((iLen+2)/3)*4;         // output length including padding
         char[] out = new char[oLen];
         int ip = 0;
         int op = 0;
         while (ip < iLen) {
            int i0 = in[ip++] & 0xff;
            int i1 = ip < iLen ? in[ip++] & 0xff : 0;
            int i2 = ip < iLen ? in[ip++] & 0xff : 0;
            int o0 = i0 >>> 2;
            int o1 = ((i0 &   3) << 4) | (i1 >>> 4);
            int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
            int o3 = i2 & 0x3F;
            out[op++] = map1[o0];
            out[op++] = map1[o1];
            out[op] = op < oDataLen ? map1[o2] : '='; op++;
            out[op] = op < oDataLen ? map1[o3] : '='; op++; }
         return out; }
    Regards
    Sathish Kumar

  • HELP:Merging External File (JPG/PDF) into XDP/XML Merged PDF on Client

    I need some serious help pointing me in the right direction.
    What I have...and is working:
    I have an Invoice Template/PDF/Form created by LiveCycle with form fields.  When requested by the user, in real-time I send XML from my server that is merged with the PDF template to create a single PDF file with multiple pages of invoices.  Each invoice fits on one page.  Works great...technically I think this is called or used XDP to merge the two on the client computer with a PDF and XML being supplied by the server.
    The server is just a generic Unix/PHP/MySQL environment...no Adobe products are installed (or can be installed on that machine).  I rely entirely on the client's computer to assemble and create the finished PDF.
    What I NEED:
    So the client is now asking that I be able to insert receipts into the invoice PDF stream.  So in order words you would still have the invoices above, but if we happen to have scanned receipts for a given invoice, they want those embedded into the PDF.  A finished product would look like:
    Page 1 - Invoice 00001
    Page 2 - Receipt #1 for Invoice 0001
    Page 3 - Receipt #2 for Invoice 0001
    Page 4 - Invoice 00002
    Page 5 - Invoice 00003
    Page 6 - Receipt #1 for Invoice 0003
    etc.
    Can someone point me in the right direction to make this happen?
    Perfect world, I would like to have the invoices be actual images of the receipts (assume we need to have a JPG or PDF scan of the receipt)
    Okay world, I guess we could just attach the actual document so if it is XLS, DOC, PDF...etc...I don't need to convert...just attach.
    Last choice, I could just include hyperlinks back to our server for the client to click on and open the receipt document as we store it.

    From your post it sounds like you are Central Pro (a product for which I am by no means an expert), but you say you want to upgrade to a newer product from your "legacy" one. Is there a reason for this? Have your requirements change so that it no longer fits them? Central is still in the current Adobe roster and as far as I know there is no plans to get rid of it any time soon, so if it does everything you want I don't see why you would want to change.
    There is no product in the LiveCycle suite that merges xml data into a form from the command line. LiveCycle (with the exception of Designer) is a suite of server products, so the closest you would come is LiveCycle Forms (merge the xml and create a fillable PDF) or LiveCycle Print (merge the xml and print the form).
    Hope this helps somewhat.
    Chris
    Adobe Enterprise Developer Support

  • Trying to save the data from the pdf into XML

    I have Adobe Live Cycle 8.0 installed and without the blade for Reader Extension.
    The objective is to save the editable data from the pdf into a XML file
    the code for that is:
    // to fetch the input pdf file from the local drive
    FileInputStream fileInputStream2 = new FileInputStream("C:\\Adobe-Final PDF\\stitched_Letters.pdf");
    Document inPDF = new Document(fileInputStream2);
    Properties connectionProps=new Properties();
    connectionProps.load(new FileInputStream(_propertiesPath));
    //propertiesPath is the path of the properties file
    ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
    FormDataIntegrationClient dataClient = new FormDataIntegrationClient(myFactory);
    Document resultPDF=dataClient.exportData(inPDF);
    What happens is that this ultimate resultPDF does not get the XML with data but rather with empty tags. Does this require Reader Extension?

    //Set connection properties required to invoke LiveCycle ES
    Properties connectionProps = new Properties();
    connectionProps.setProperty("DSC_DEFAULT_EJB_ENDPOINT", "jnp://localhost:1099");
    connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","EJB");
    connectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");
    connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "administrator");
    connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");
    //Create a ServiceClientFactory object
    ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
    //Create a FormDataIntegrationClient object
    FormDataIntegrationClient dataClient = new FormDataIntegrationClient(myFactory);
    //Reference a PDF form from which to export data
    FileInputStream fileInputStream2 = new FileInputStream("C:\\Adobe\\Loan.pdf");
    Document inputPDF = new Document(fileInputStream2);
    //Export data from the form
    Document resultPDF = dataClient.exportData(inputPDF);
    //Save the exported form data as an XML file
    File resultFile = new File("C:\\Adobe\\formData.xml");
    resultPDF.copyToFile(resultFile);
    }catch (Exception e) {
    e.printStackTrace();

  • Embed an external PDF file into the XML

    Dear All,
    We have a program which creates the XML file on the Application server when we execute it.
    My requirement is to Embed an external PDF file into the XML file while generating it through
    program from SAP.
    Please let me know how this is possible.
    Thanks & Regards,
    Vinit

    Yes, you can do it. You have to use an absolute path and add it not only to the folder but to the .manifest
    I wrote a blog post explaining how to do it:
    http://www.captivatecrazy.blogspot.com/#!http://captivatecrazy.blogspot.com/2012/03/embed- pdf-in-captivate-for-lms.html

  • Convert PDF to Base64

    Hello everyone,
    We have implemented in our SAP the Digital Invoice Mexico. We send a XML file based on the billing document according of all SAP Notes. This process was perfect.
    Now we have a customer that need to receive a PDF file encoding in base64. This value need to be send in XML file, so I need generate this code and insert this value in XML file.
    We wold like to know if there are some function in SAP that could convert this file PDF in base64.
    Thanks in advanced
    Mary Nuvoloni

    Check this link PDF to BASE64 conversion
    I suggest you to post in ABAP forum.
    Regards,

  • How to use VBA in Excel to convert a pdf file to XML?

    Hello,
        I need to convert pdf to XML format so that it can be imported into Excel workbook and the information can be extracting out and mapped to existing excel cells. What is the easiest way to get it down without introduce any additional tools/software
    other than Microsoft products? Client want to keep their process simple and it will be used for many agents in remote locations. They mentioned that they want to use VBA to do it. I could not find much useful information on this. Thanks a lot!
    Wei

    No Office programs can open a pdf and edit the contents so you will have to get a different app to convert teh pdf into xls format. There are plenty to be found on the web.
    Rod Gill
    The one and only Project VBA Book
    Rod Gill Project Management

  • How to convert the TEXT file into an XML using plsql code

    Hi all ,
    I need to convert an TEXT file into an XML file how can i do it
    Below is my sample TEXT file .
    TDETL00000000020000000000000120131021115854ST2225SKU77598059          0023-000000010000
    I want the above to be converted into the below format
    <?xml version="1.0" encoding="UTF-8"?>
    <txt2xml>
      <!-- Processor splits text into lines -->
      <processor type="RegexDelimited">
      <regex>\n</regex>
            <!--
            This is used to specify that a message should be created per line in
            the incoming file;
            NOTE: this was designed to work with all the processors, however it
            only works correctly with 'RegexDelimited' processors (check the
            enclosing top processor type)
             -->
             <maxIterationsPerMsg>1</maxIterationsPerMsg>
      <!-- For lines beginning with FHEAD (File Header) -->
      <processor type="RegexMatch">
      <element>FHEAD</element>
      <regex>^FHEAD(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,Type,Date</element>
      <regex>^(\d{10})(\w{4})(\d{14})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with TDETL (Transaction Details) -->
      <processor type="RegexMatch">
      <element>TDETL</element>
      <regex>^TDETL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransControlNumber,TransDate,LocationType,Location,ItemType,Item,UPCSupplement,InventoryStatus,AdjustReason,AdjustSign,AdjustQty</element>
      <regex>^(\d{10})(\d{14})(\d{14})(\w{2})(\d{4})(\w{3})([\w ]{13})([\w ]{5})(\d{2})(\d{2})([+-]{1})(\d{12})$</regex>
      </processor>
      </processor>
      <!-- For lines beginning with FTAIL (File Tail) -->
      <processor type="RegexMatch">
      <element>FTAIL</element>
      <regex>^FTAIL(.*)</regex>
      <processor type="RegexMatch">
      <element>OriginalLine</element>
      <regex>(.*)</regex>
      <consumeMatchedChars>false</consumeMatchedChars>
      </processor>
      <processor type="RegexMatch">
      <element>LineSeq,TransCount</element>
      <regex>^(\d{10})(\d{6})$</regex>
      </processor>
      </processor>
      </processor>
    </txt2xml>
    Thanks

    Sorry, that doesn't make much sense.
    The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
    Are you a user of this utility?

  • How to automate conversion of PDF forms to XML format

    Hi
    I have created a form using adobe livecycle designer 8. It has a email submit button that will send the form as a pdf file to a server.
    Once the server recevive this pdf file, they will store the pdf file into a local drive. How do I convert the pdf files in the local drive into XML format without actually opening the pdf file in the Adobe Professional and clicking export data as XML?
    Is there a way to write a code to convert these pdf files to XML format automatically?
    Hope someone can help me with this issue
    Regards
    Delvin Khong

    Hi Andersson,
    The request command is a form server command? Where do i type the Request.Form("page.form.field"). I dont really understand your statement on "Use request on the receiving page to get data" Could you help me by explaining more?
    Thank a lot for your advice
    Warmest Regards
    Delvin Khong

  • Pdf file to Xml Scenario

    Hi friends,
    How can i do PDF file to XML scenario in XI.
    Please help me in this
    Thanks in advance
    Sreedivia

    Hi All,
    We can convert PDF to XML using Java mapping. Below is the basic code for that:-
    * To change the template for this generated file go to
    * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package Shubham1;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.HashMap;
    import java.util.Map;
    import com.lowagie.text.pdf.PdfReader;
    import com.lowagie.text.pdf.parser.PdfTextExtractor;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    * @author shubham.e.agarwal
    * To change the template for this generated type comment go to
    * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class Shubham2 implements StreamTransformation{
    private Map map = null;
    private AbstractTrace trace = null;
    public void setParameter(Map arg0) {
      map = arg0; // Store reference to the mapping parameters
      if (map == null) {
       this.map = new HashMap();
    /*public static void main(String[] args) { //FOR EXTERNAL STANDALONE TESTING
    try {
      FileInputStream fin = new FileInputStream ("C:\\test.pdf"); //INPUT FILE (PAYLOAD)
      FileOutputStream fout = new FileOutputStream ("C:/Users/Shubham.e.agarwal/My Documents/pdfXML.xml"); //OUTPUT FILE (PAYLOAD)
      Shubham2 mapping = new Shubham2();
      mapping.execute(fin, fout);
      catch (Exception e1) {
      e1.printStackTrace();
    public void execute(InputStream inputstream, OutputStream outputstream) {
      try {
       String msgType = "MT_shubham"; //A dummy Message type, please change it as per your requirement.
       String nameSpace = "http://Shubham"; //A dummy namespace, please change it as per your requirement.
       String str;
       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);
       str = str + pdf.getTextFromPage(1);
       str= str+"\n</Record>"+"\n</ns0:MT_shubham>";
       byte by[] = str.getBytes();
       outputstream.write(by);
       reader.close();
       outputstream.close();
       System.out.println(str);
      catch(Exception e){
       e.printStackTrace();

  • Runtime Error For Converting Static pdf to Dynamic Xml Form pdf

    Hi All,
    I am converting my static pdf to dynamic xml form pdf using Adoble Livecycle Designer ES 8.2 it is giving runtime error dialog.
    My static pdf size is 12MB and it contains 46 pages(mostly all pages will have images). Do we have any limitations for converting static pdf to dynamic xml form pdf ?
    Error message image file is attatched to this thread.
    Can any body please help me on this.
    Advance Thanks
    Prasad Sagala

    Hi Paul,
    With out dividing into smaller chunks, Do we have any other alternative?
    Because in my other pdf reports having more than 50 pages (in between 100-600). If i want do divide smaller chunks it will be the long process.
    Thanks
    Prasad Sagala

  • I purchased PDF Converter Plus, v1.0 (4 ). I am unable to convert PDF into text. I get all gibberish when I try to do the conversion.

    I purchased PDF Converter Plus, v1.0 (4 ). I am unable to convert PDF into text. I get all gibberish when I try to do the conversion.

    I went to the site and did exactly as the 'support' said. I tried three PDF documents for conversion to Word. On clicking 'convert', the last window gives the file with .doc suffix. After I save and open it the window says, "The XML file cannot be opened because there are problems with the contents." Under "Details", it says, "Incorrect document syntax".
    Please guide me further.
    Thanks

  • PDF imbedded in XML

    Hi
    we are currently reviewing the possible solutions for imbedding PDF into XML.
    Our scenario is as follow.
    We want to sent a generated PDF to PI (7.1) from SAP ERP 6.
    So:
    SAP ERP 6 ->Send XML control data(docnr, date etc) + Generated PDF->PI->Map Generated PDF and control fields to new XML->Partner
    How to do this? According to the BIT400 course it is mentioned it is possible.
    Anyone tried this and could lead me/explain me a possible solution scenario? Any "pitfalls"?
    My sender adapter should that be RFC or is PROXY (or other most relevant)?
    How to perform the mapping in PI when it is an "embedded" PDF document?
    Cheers all

    My sender adapter should that be RFC or is PROXY (or other most relevant)?
    How to perform the mapping in PI when it is an "embedded" PDF document?
    1. it is possible to send any file as an attachment from a proxy
    2. Do you want to reach the content of the PDF?
    if so then it is not possible in a standard way. You might have to either write your own adapter module to read the PDF or use tools like Conversion Agent to parse data.

  • Help bring a multipage scanned document (TIFF) in PDF format using XML Publ

    Help bring a multipage scanned document (TIFF) in PDF format using XML Publisher.
    In the generated XML file data into BLOB field is, but their XML Publisher can not handle.
    If the output TIFF, multipage PDF file in the report, the report prints a blank.
    <fo:instream-foreign-object content-type="image/tiff"> <xsl:value-of select=".//FILE_DATA"/>
    If the output JPG file to a PDF report, all displayed perfectly.
    <fo:instream-foreign-object content-type="image/jpg" height="9 cm" width="12 cm">
    <xsl:value-of select=".//FILE_DATA"/>
    Thanks

    It seems that these error messages MOD_OC4J_0184 etc are associated with some sort of timeout.
    My problem finally solved - see my comments at:
    Re: FOP
    I would like to see the PDF format using FOP docs made clearer that 2 http servers are involved in this process, one serving htmldb pages and the other oc4j stuff.
    Is it possible to do the PDF format using FOP with only the htmldb http server??
    Cheers
    KIM

  • Encode a message into the picture

    Hi,
    regarding the subject above, i know how to encode a static message (which mean predefined the message) into a picture..
    But when it come to the dynamic message (user can enter message), i really no idea on how to encode it in the picture..
    example for how i encode it for static msg :
    predefined msg = "ON"
    O = 79 = 01 00 11 11 c1, c2, c3, c4
    N = 78 = 01 00 11 10 d1, d2, d3, d4
    //0xFC = 1111 1100 <-- used this to remove the last 2 bits
    int c1=1, c2=0, c3=3, c4=3;               //O
    int d1=1, d2=0, d3=3, d4=2;               //N
    int alpha, red, green, blue;
    //unpack the individual pixel n process
    alpha     = (pixels[1]>>24) & 0xFF;
    red     = ((pixels[1]>>16) & 0xFC) + c1;          
    green     = ((pixels[1]>>8) & 0xFC) + c2;
    blue     = (pixels[1] & 0xFC)     + c3;
    //repack the pixels
    pixels[1] = (alpha<<24) | (red<<16) | (green<<8) | blue;
    //unpack the individual pixel n process
    alpha     = (pixels[2]>>24) & 0xFF;
    red     = ((pixels[2]>>16) & 0xFC) + c4;          
    green     = ((pixels[2]>>8) & 0xFC) + d1;
    blue     = (pixels[2] & 0xFC)     + d2;
    //repack the pixels
    pixels[2] = (alpha<<24) | (red<<16) | (green<<8) | blue;
    //unpack the individual pixel n process
    alpha     = (pixels[3]>>24) & 0xFF;
    red     = ((pixels[3]>>16) & 0xFC) + d3;      
    green     = ((pixels[3]>>8) & 0xFC) + d4;
    blue     = (pixels[3] & 0xFC); // no use.... finish used all the bits
    //repack the pixels
    pixels[3] = (alpha<<24) | (red<<16) | (green<<8) | blue;
    But when came to dynamic msg.. i really no idea on how to continue..
    when i get everything ready.. (the msg length, each char value) in the for loop..
    for(int j=0; j<length; j++){
    msg[j] = message.charAt(j);
    value[j] = (int) msg[j];
    //this is to get the binary no.
    c1= (value[j]>>6) & 0x03;
    c2= (value[j]>>4) & 0x03;
    c3= (value[j]>>2) & 0x03;
    c4= value[j] & 0x03;
    Encode(); //call a method to encode the msg into the picture
    wanted to encode it in the picture..
    but the requirement is encode only in the RGB and not alpha..
    so when i get the value (O = 01 00 11 11)
    c1 = 1 c2 =0 c3=3 c4=3
    alpha     = (pixels[1]>>24) & 0xFF;
    red     = ((pixels[1]>>16) & 0xFC) + c1;          
    green     = ((pixels[1]>>8) & 0xFC) + c2;
    blue     = (pixels[1] & 0xFC)     + c3;
    pixels[1] = (alpha<<24) | (red<<16) | (green<<8) | blue;
    but the c4 is not encoded yet... so how ?? what should i do in this method ? because after processing this, it should go back to the for loop to continue the next char.
    c1,c2,c3,c4 will be initialized with the new value again...
    As you can see in the static example, c4 is used in the pixels[2]... then continue with the next char's 1st 4 bit (d1,d2)..
    d3 & d4 is used in the pixels[3]...
    err.. hope you can understand my question and give me some ideas on "encoding a message into the picture"
    thanks and appreciate every single idea & help ;)

    Take a look in the indesign-server-plugin-techniques.pdf in the section on MessageLog for more info.
    Something interesting is that code that calls CAlert methods get converted into MessageLogs.
    Your use of the word "console" makes me think that you are coding for Mac. If that's the case you could create some Mac code and use NSLog to dump to console.
    Create a MyLog.mm file with something like:
    #import <Foundation/Foundation.h>
    void MyLogMessage(char *msg)
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSLog(@"%s", msg);
    [pool release];
    Remember to add the Foundation framework to your project, and change the compile option from compile all files as C++ to compile according type.

Maybe you are looking for

  • Cannot view streamed photos in web browser

    I have set up a photo stream from my iPhone and have set it up as a "Public Website" so that friends and family that do not have Apple devices can view the photos. Everything was working fine for about two months, but in the past couple of days peopl

  • DTW error when importing AR Invoices

    Hello, I'm using DTW to import AR invoices on SAP 2007, ana I'm getting the following error "Document Date deviates from the defined range", The periods are created correctly and the dates are within the range. Do you have any idea of why this is hap

  • How to embed word docs

    I have created an application using coldfusion that takes a bunch of inputs to produce an HTML page which gets emailed to the user.  In this app the user can upload files to be attached to the html page.  The problem I am having is the users don't ha

  • Code to parse java code

    anyone know where we can get the code that parses the Java code that we put here ? i was thinking it would be a good base to use as a pre-compiler project - so we can have pre-compiler flags like in c - say to include logging ... example of the code

  • [svn:bz-trunk] 21286: Also need to change 2 more private members to protected in order to make the first call after login

    Revision: 21286 Revision: 21286 Author:   [email protected] Date:     2011-05-20 11:43:00 -0700 (Fri, 20 May 2011) Log Message: Also need to change 2 more private members to protected in order to make the first call after login Modified Paths:     bl