Attach an xml to a pdf using ADS

Hi all,
I have a scenario where we are sending a Base64 encoded PDF (a bill) and the corresponding xml data from SAP backend on level 4.6C to PI 7.1. In PI we should attach the xml data to the PDF. I have already succeeded to do this using iText but we have a requirement to do this with ADS instead. In Netweaver Developer Studio I created an example project where I am reading a PDF as a byte array, also reading an XML file and try to attach the XML to the PDF using the ADS api. The project successfully built in NWDS but when I am running the project it failes.
I am using standard code to attach the xml stream to the pdf, the error message is thrown when the following line is executed:
IWDPDFDocument document = context.execute();
Exception in thread "main" java.lang.ExceptionInInitializerError
     at com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.impl.PDFDocumentAccessibleContextWDImpl.execute(PDFDocumentAccessibleContextWDImpl.java:99)
     at com.eon.xi.dijnet.base64.PdfWithAttachment.addAttachmentWithSap(PdfWithAttachment.java:129)
     at com.eon.xi.dijnet.base64.PdfWithAttachment.main(PdfWithAttachment.java:218)
Caused by: java.lang.NullPointerException
     at com.sap.tc.webdynpro.services.sal.deployment.core.DeployableObjectInternal.getSystemDeployableObjectName(DeployableObjectInternal.java:53)
     at com.sap.tc.webdynpro.clientserver.uielib.adobe.impl.AdobeFormHelper.<clinit>(AdobeFormHelper.java:115)
     ... 3 more
Is it the problem with the PDF that it is not an Interactive Form?
Or the problem is simply that I am trying to run the project on my local machine where ADS is not available?
Thanks for your help.
Pal
Edited by: Pal Somogyi on Oct 17, 2010 10:30 PM
Edited by: Pal Somogyi on Oct 18, 2010 11:44 AM

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 and re-generate a PDF.
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.
You have mentioned that you have had to send a base 64 encoded pdf. Could you pelase guide me through the process?
Thanks,
Preethi.

Similar Messages

  • Import external xml file in PDF using Livecycle

    I require sending some values in main xml file from the external xml file during sending mail on button click. Doing so, I want to read values from external file into a hidden field or send the external xml/text file as an attachment.
    1. Is there any feature in live cycle to attach multiple xml/text files in mail using button click?
    2. Is there any way to read an external xml file to pre-populate a textbox using javascript?
    Kindly help me to find out the solution.
    Thanks in advance
    Vikram Kumar

    Hi,
    1) You can do this with a script. But this script works only with the Acrobat Pro not with the Adobe Reader!!
    2) Sure.
    You open your form.
    Go to File | Form Properties |  Preview | then choose your xml-file
    Then you have to got to the textobject | mark this | go to "Object" | "Binding"
    Here you can bind the field: $record.PRINTJOB.PMSDATA.ObjectNameXML (You have to adapt this in the path in your XML to the field in the XML)
    If you make a preview you will see the value of the XML in your textfield.
    You can also script the databinding. You have to go to the initalize.event and write:
    this.rawValue = xfa.record.PathToYourFieldInYourXML.ObjectNameXML.value;
    Hope it will helps you,
    Mandy

  • Generating pdf using ADS on another Server failed

    Hi there,
    I am trying to generate a pdf-document using Adobe Document Services installed on another server.
    It's a Visual Composer app, which opens a Web Dynpro component to generate the pdf. Everything works fine when I run the app on a server, which has Adobe Document Services installed.
    But when I try to run the app on a server without ADS installed and want to use ADS on another server (both NW 7.3 SPS4) it fails with and FileNotFoundException.
    The log of the ADS-Server says, that it cannot found the file located in <PATH TO THE XDP-FILE ON THE APP-SERVER>. It's sure, that the server cannot find the file, because it's not deployed there!
    It seems that the Application calls the Adobe-System which trys to find the template on its own file-system.
    Does anybody know the mistake here?
    Any help would be greatly appreciated
    Edited by: Bernd Speckmann on Oct 17, 2011 10:31 AM

    The problem was, that I was passing xdp template source as url .
    Instead I should send it as a stream using the appropriate pdfdocument api.

  • Pass XML Data Between PDFs Using openDoc

    I would like to pass data from one PDF to another in the openDoc() function. How do I pull the XML data, store it, then push it to the second PDF?
    Thanks

    Steve,
    I tried the code in the http package in the Appendix A section of your book. Each time i try a POST I get a HTTP/1.1 400 Bad Request error from the server. I can successfully do a GET from URLs. I have pretty much copied your code verbatim. Any ideas?
    Thanks,
    Sunder
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    See the "Working with XML Messages" section starting on page 242 of my Building Oracle XML Applications. It covers how to Send and Receive XML messages over the web through HTTP GET and HTTP POST as well as specifically Example 6-30 that illustrates how to receive a posted XML message in a servlet and process it.
    Hope this helps.<HR></BLOCKQUOTE>
    null

  • What happens to attachment in a PO when it is converted to PDF using SPOOL.

    Hi Experts,
    While converting a PO to PDF using a spool number, it works fine but i have a question as If the PO has an attachment, does the spool take care of that also?
    If not how to download the attachment as well.
    Thanks & Regards,
    K

    Hi Shan,
    No in ME21N there is a tab called Attachment, by which we can attach a note or something(I am thou not sure why this is done), yes a script is generated into a PDF but this attachment which is part of PO does it get attached or we need to do somthing to attach it to PDF was my question?
    Cheers,
    K
    Edited by: Ken Thompson on Sep 29, 2008 5:58 AM

  • Saving SAPSCRIPT to a PDF file using ADS

    Hello,
    I had posted this message on thread Re: Want SAPSCRIPT Work orders to be saved as PDF via ADS. but i was adviced to post it here.
    I need to know whether a SAPSCRIPT (Work Order) in SAP ECC ABAP can be saved as a PDF form if ADS is installed and Configured?
    We have a 3rd party converter installed on users desktop which converts it into PDF so when user goes to IW32 to print WO, they get a print pop-up and they select this 3rd party converter which gives them the option to save it as PDF file.
    We need to know (since we have ADS installed/configured), whether it is possible to save this SAPSCRIPT WO to PDF instead of using this 3rd party tool? We dont want people to install the 3rd party converter since we have over 5000 users.
    Any help is appreciated.
    Thanks
    WR

    Hi try this below coding
    data: binfilesize type i.
      data: pdftab type table of tline with header line.
      data: i_itcpp like itcpp.
    DATA: i_zinv_spool LIKE zinv_spool OCCURS 0 WITH HEADER LINE.
    CLEAR i_zinv_spool. REFRESH i_zinv_spool.
      data: g_t_otfdata type standard table of itcoo with header line.
    DATA filename TYPE string.
      call function 'CLOSE_FORM'
       IMPORTING
         RESULT  = i_itcpp
          tables
            otfdata = g_t_otfdata[]
          exceptions
            others  = 1.
      if sy-subrc ne 0.
        retcode = sy-subrc.
        perform protocol_update.
      endif.
      call function 'CONVERT_OTF'
    exporting
    format = 'PDF'
    MAX_LINEWIDTH = 132
    ARCHIVE_INDEX = ' '
    COPYNUMBER = 0
    ASCII_BIDI_VIS2LOG = ' '
    PDF_DELETE_OTFTAB = ' '
    importing
    bin_filesize = binfilesize
    BIN_FILE =
    tables
    otf = g_t_otfdata[]
    lines = pdftab[]
    EXCEPTIONS
    ERR_MAX_LINEWIDTH = 1
    ERR_FORMAT = 2
    ERR_CONV_NOT_POSSIBLE = 3
    ERR_BAD_OTF = 4
    OTHERS = 5
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    call function 'GUI_DOWNLOAD'
      exporting
      bin_filesize = binfilesize
      filename = filename
      filetype = 'BIN'
    tables
      data_tab = pdftab[]
    Thanks & Regards,
    Vallamuthu.M

  • Convert list item attachment from docx to pdf using Word Automation Services

    I have been trying to convert List Item attachments from docx to pdf using word automation services, it works in a normal document library but when I use the list attachment it throws a null reference error.
    var settings = new ConversionJobSettings();
    settings.OutputFormat = Microsoft.Office.Word.Server.Conversions.SaveFormat.PDF;
    var conversion = new ConversionJob("Word Automation Services", settings);
    conversion.UserToken = SPContext.Current.Site.UserToken;
    var wordFile = SPContext.Current.Site.RootWeb.Url + "/" + wordForm.Url;
    var pdfFile = wordFile.Replace(".docx", ".pdf");
    conversion.AddFile(wordFile, pdfFile);
    conversion.Start();
    Using reflector I was able to see my problem lies in Microsoft.Office.Word.Server.FolderIterator.cs where it uses SPFile.Item which returns NULL
    internal void CheckSingleItem(SPFile inputFile, SPFile outputFile)
    Microsoft.Office.Word.Server.Log.TraceTag(0x67337931, Microsoft.Office.Word.Server.Log.Category.ObjectModel, Microsoft.Office.Word.Server.Log.Level.Verbose, "OM: FolderIterator start a single item: source='{0}'; dest='{1}'", new object[] { inputFile.Url, outputFile.Url });
    Stopwatch stopwatch = Microsoft.Office.Word.Server.Log.StartPerfStopwatch();
    try
    this.CheckInputFile(inputFile.Item);
    this.CheckOutputFile(outputFile.Url);
    Is there any way to get around this?

    Hi Qfroth,
    According to your description, my understanding is that when you use word automation service to convert Word to PDF for list item attachment, it throws the null reference error.
    I suggest you can create an event receiver and convert the word to memory stream like below:
    private byte[] ConvertWordToPDF(SPFile spFile, SPUserToken usrToken)
    byte[] result = null;
    try
    using (Stream read = spFile.OpenBinaryStream())
    using (MemoryStream write = new MemoryStream())
    // Initialise Word Automation Service
    SyncConverter sc = new SyncConverter(WORD_AUTOMATION_SERVICE);
    sc.UserToken = usrToken;
    sc.Settings.UpdateFields = true;
    sc.Settings.OutputFormat = SaveFormat.PDF;
    // Convert to PDF
    ConversionItemInfo info = sc.Convert(read, write);
    if (info.Succeeded)
    result = write.ToArray();
    catch (Exception ex)
    // Do your error management here.
    return result;
    Here is a detailed code demo for your reference:
    Word to PDF Conversion using Word Automation Service
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Converting xml file with arabic content to pdf using FOP

    Hello all
    I am trying to convert a dynamically generated xml file in which most of the data comes from the oracle database with arabic content, to pdf using FOP. I have used "Windows-1256" encoding for the xml. If i open the xml generated with the internet explorer the arabic content displays properly but the pdf is not generated and the acrobat reader shows the file as corrupted or not supported. Please help me. Its very urgent.
    Thanks & Regards
    Gurpreet Singh

    There is no direct support for importing RTF from an XML extract. Perhaps feature 1514 "Mapping formatted XML data into multiline field" will be of some use. This was released in 11.0, I believe.
    Essentially you can establish paragraph and certain text formatting like bold and underline when you include the proper token information in the data. I believe this is similar to simple HTML tokens.
    Example: &lt;FIELD>&lt;P>First paragraph of data.&lt;/P>&lt;P>New paragraph with &lt;B>&lt;U>bold and underline text&lt;/U>&lt;/B>. Rest of paragraph normal.&lt;/P>&lt;/FIELD>
    The result is something like this:
    <P>First paragraph of data.</P><P>New paragraph with <B><U>bold and underline text</U></B>. Rest of paragraph normal.</P>

  • Set password to PDF file using ADS server

    How to set password to .PDF file using ADS(Adobe Development Service) server?
    Moderator Message: Not enough effort seen from OP. Thread Locked.
    Edited by: kishan P on Jul 14, 2011 11:51 AM

    Thanks for your prompt reply. Well forget about conversion but there should be a way to just password protect any PDF file, correct?
    We have a 3rd party tool which does that for our VB6 apps, I am surprised how come Acrobat SDK doesn't expose those Properties/Methods for VB6 model.
    Andy

  • How to Get XML from the PDF form generated using Designer that is stored in LC

    We have a Requirement of Generating reports on what a PDF form is comprised of? It is easy for us to scan / parse the XML format of the PDF form and get all the relavent Info we need. We are able to see the XML format of the PDF form when we open up the Form in Designer.
    But we are trying to run this report in a Batch Mode for many PDF files. I need to know how to get a XML format of the PDF file that is stored in LC that was developed using Designer. Once we are able to get the XML of the PDF form it is just a scan / parse to get the relavent data.
    Can some one tell me how to get the XML format of a PDF file stored in the LC?

    If I place the PDF form on the LC server - Can you let  me know of the tools you are referring to get XML design from the PDF form?
    Is it through a Process Orchestration I need to run the PDF through to get a XML design out of it?
    I am fine in storing the PDF in the LC server? How will I get the XML design (XML) from this PDF on the server?

  • Attach PDF using UTL_SMTP

    Hi,
    I am trying to attach a pdf file in an email using UTL_SMTP builtin but the when i get the email
    and try to open it then Adobe Reader says cannot open as file may be damaged or is not able to decode it.
    I am pasting the code i am using below. i read some threads from this forum and some help from google to use this code but now i am not able to figure out what i need to do so please help me.
    Regards
    declare
    p_sender VARCHAR2(100);
    p_recipient VARCHAR2(500) := '[email protected]';
    p_subject VARCHAR2(500) := 'Test attachement';
    p_message VARCHAR2(500) := 'This is email body';
    p_filename  VARCHAR2(500) := '/udlpdrop/dev10g/eor/WS_FTP.LOG'; PATELMK_eordetail.pdf';
    p_filename VARCHAR2(500) := '/udlpdrop/dev10g/eor/PATELMK_eordetail.pdf';
    v_recordkeys eor.exception_log.rec_keys%TYPE;
    v_msg VARCHAR2(32000);
    p_blob blob;
    i integer := 1;
    v_raw raw(57);
    v_length integer := 0;
    v_buffer_size integer := 57;
    v_mailconn utl_smtp.connection;
    gc_crlf VARCHAR2(4) := chr(13) || chr(10);
    gc_lf VARCHAR2(4) := chr(10);
    gc_mailhost eor.sys_config.sys_var_value%TYPE := 'ykmail.goldlnk.rootlnka.net';
    gc_maildomain eor.sys_config.sys_var_value%TYPE := 'goldlnk.rootlnka.net';
    BEGIN
    v_mailconn := utl_smtp.open_connection(gc_mailhost,25);
    utl_smtp.helo(v_mailconn,gc_mailhost);
    utl_smtp.mail(v_mailconn,gc_maildomain);
    utl_smtp.rcpt(v_mailconn,p_recipient);
    utl_smtp.open_data (v_mailconn);
    utl_smtp.write_data(v_mailconn, 'Content-Type' || ': ' || 'application/pdf' || utl_tcp.CRLF);
    utl_smtp.write_data( v_mailconn, 'Content-Disposition: attachment; filename="' || p_filename || '"' || utl_tcp.crlf);
    utl_smtp.write_data( v_mailconn, 'Content-Transfer-Encoding: base64' || utl_tcp.crlf );
    utl_smtp.write_data( v_mailconn, utl_tcp.crlf );
    v_length := dbms_lob.getlength(p_blob);
    while i < v_length loop
    dbms_lob.read( p_blob, v_buffer_size, i, v_raw );
    utl_smtp.write_raw_data( v_mailconn, utl_encode.base64_encode(v_raw) );
    utl_smtp.write_data( v_mailconn, utl_tcp.crlf );
    i := i + v_buffer_size;
    end loop while_loop;
    utl_smtp.write_data( v_mailconn, utl_tcp.crlf );
    utl_smtp.close_data (v_mailconn);
    utl_smtp.quit(v_mailconn);
    EXCEPTION
    WHEN OTHERS THEN
    utl_smtp.quit(v_mailconn);
    dbms_output.put_line(sqlcode||sqlerrm);
    END;

    Don't answer, duplicate of Re: Attach PDF using UTL_SMTP

  • Problem in attaching a xml file in Email Notification

    Hi,
    I am new to BPEL. I am using 10.1.3.4 Jdev. Facing a problem in attaching a xml file in Email Notification process. I do not get any email when ever the attachment is a xml. Whereas when the attachment is a pdf, i get the pdf in the mail. I have put the mime type as text/xml. Used ora:doc() to read the xml. Dont know what i am missing. Please help me out. Thanks.
    Edited by: friendsforever on Oct 6, 2010 1:05 AM

    actually i want that when a user open my website register form then he must attached their resume in it
    so i want to know how can i make a field of attaching.
    please reply
    I am waiting for your reply

  • PDFs using BI publisher and special characters - pound sterling

    I have a table with character strings which include the £ pound sterling sign.
    If I create an xml file from the table using the escape sequence for the pound sign & # 163; and load it into BI publisher, the pdf renders correctly using an rtf template.
    If I include the pound sign in the rtf template itself the pdf renders correctly and if I use a report query in Apex based on the table, and an rtf template then the pdf renders correctly.
    However there is a limit to the number of columns that can be sent to BI via the report query - we have found this to be 119 columns. For more than this we have been using a stored function to return xml data as a clob and use the clob to generate the pdf with the rtf report layout (using get_print_document). This method works fine but the pound sign is not rendered correctly (appears as "?").
    The NLS_LANG is set to english_united kingdom in the database and in BI publisher. The locale in bi publisher is en_GB. BI will create the pdf correctly with the pound sign if using a standard xml file (with escape seq for pound) so I am sure it is not a language issue in BI/Apex.
    Any ampersands in the xml cause the pdf to fail completely and we cannot represent special characters with a sequence containing the ampersand for this reason. I have tried "& # 163;" and "& amp;#163;" and variations and have also tried using CDATA, none of which gives the correct pdf output. I have also tried to switch the encoding to Windows-1252 or ISO-8859-1 in the header of the xml (xml generated by stored procedure so can control this), but this gives incorrect results too.
    We also need to send other special characters to BI via get_print_document and apex (bullet points, ampersands, dashes ) but cannot use the escape sequences because of the ampersand problem.
    Has anyone had any success with this?
    Is there any plan ( for a future version of Apex) to increase the number of columns that can be used in report query using Apex/BI publisher?
    Thanks
    Kathryn

    Hi Kathryn
    I've had exactly the same problem as you've mentioned.
    Firstly, I've also found that I cannot select more than 119 columns from a view using a report query and have opted to the use the stored function to return the xml (same as you).
    After conducting a lot of searching and experimenting i've found that you can use the following escape characters in REPLACE in your stored function:-
    '£' can be replaced with CHR(194)||CHR(163)
    '%' can be replaced with '%25'
    '&' can be replaced with '%26amp;'
    I found the above escape characters from the xml file or by opening the xml file in Wordpad. Therefore I'm sure you'll be able to find the escape characters for the other symbols that you mentioned i.e. bullet points, dashes etc.
    I hope this has helped. Good luck and let me know if you get any developments with the limitation on the number of columns that can be selected from a report query as this would save a lot of trouble (as I'm sure you're aware).
    Thanks
    Natalie

  • Filename of a attachment: *.csv XML IDOC

    Hi folks,
    our scenario is:
    1. are receiving mails with a csv file as an attachment
    2. we use a senderChannel with the Mail adapter to get the mails
    3. we swap the mail content with the attachment with localejbs/AF_Modules/PayloadSwapBean
    4. we transform the "attachment" to XML with
    localejbs/sap.com/com.contentmaster.CMTransformModule/CMTransformBean
    5. we use the mail adapter
    localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
    My question:
    We need the filename in SAP but I have no idea how I can get the filename after the swap. Is it possible to get the filename and how can I integrate the filename into the XML or IDOC?
    Andreas Solf

    Hello again,
    still searching for a solution.
    The payload data are:
    Content-ID: <[email protected]>
    Content-Type: application/octet-stream;name="filename.csv"
    Content-Disposition: attachment;filename="MailAttachment-1.bin"
    Content-Description: MailAttachment-1
    <?xml version="1.0" encoding="UTF-8"?>
    How can I get the filename out of the headerdata to include it into the XML.
    Cheers Andreas
    P.S. I start my first steps in XI and I'm not a XI professional. So please send me a step by step solution.

  • Websites will convert to a PDF using Adobe Acrobat 9 but not Adobe Acrobat XI

    Hello,
    We have noticed that there are several websites that can be concerted into a PDF using Adoble Acrobat 9, but do not work with Adobe Acrobat XI. An example is the website http://amseventsubc.com/. This site converts with no problems using Adobe Acrobat 9, but will not work with Adobe Acrobat XI. When one tries to convert the website (by going Create > PDF from Web Page > Capture Multiple Levels > Get entire site > Create) it starts to work for about 10 minutes but then stops and crashes the program.
    Does anyone have a suggestion for how to fix this problem?
    Is there any reason why a website would work in an older version of Acrobat and not the most recent?
    Thanks for your help!

    Hi, we are actually not looking to have active links but rather to have the content from each link saved as part of the PDF (We are looking to convert the entire website's content to PDF). On Adobe X you can normally append any link so that its content will be converted and added to your PDF, however, this can't be done with XML links. 

Maybe you are looking for