Encrypted PDF file open error

Hi All,
problem is when i open to outlook to check mail at that time i got mail but attached file is not open which is encrypted file
so please help how to open attached file following process i do .
1: convert otf to pdf file
2: download pdf file into application server
3:encrypt pdf file with password protect
4:upload pdf file from application server
5:send mail
1. OTR TO PDF
CALL FUNCTION 'CONVERT_OTF'
   EXPORTING
     format                      = 'PDF'
     max_linewidth               = 132
*   ARCHIVE_INDEX               = ' '
*   COPYNUMBER                  = 0
*   ASCII_BIDI_VIS2LOG          = ' '
*   PDF_DELETE_OTFTAB           = ' '
   IMPORTING
     bin_filesize                = gv_bin_filesize
*   BIN_FILE                    =
    TABLES
      otf                         = gt_otf
      lines                       = gt_pdf_tab
   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.
then download pdf file into application server using following code
OPEN DATASET l_file FOR OUTPUT IN BINARY MODE  .
  IF  sy-subrc = 0 .
    LOOP AT gt_pdf_tab.
      TRANSFER gt_pdf_tab TO l_file .
    ENDLOOP.
    CLOSE DATASET l_file  .
  ELSE.
    WRITE : / 'operating system could not open file' .
  ENDIF.
*Then i use command line mode Encryptpdf, from verypdf.com, *
so successfuly file encrypted and password protected.*
Then upload pdf filw which is encrypted form application server
OPEN DATASET to_file FOR INPUT IN BINARY MODE.
  IF sy-subrc = 0.
    DO .
      READ DATASET to_file INTO gs_objbin. "GS_PDF_TAB.
      IF sy-subrc = 0.
        APPEND gs_objbin TO gt_objbin .  "GS_PDF_TAB TO GT_PDF_TAB.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    CLOSE DATASET to_file.
  ENDIF.
then i use use FM SO_NEW_DOCUMENT_ATT_SEND_API1
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data                    = gs_docdata
     put_in_outbox                    = 'X'
     commit_work                      = 'X'
* IMPORTING
*   SENT_TO_ALL                      =
*   NEW_OBJECT_ID                    =
    TABLES
      packing_list                     = gt_objpack
*   OBJECT_HEADER                    =  I_OBJTXT
     contents_bin                     = gt_objbin
     contents_txt                     = i_objtxt
*   CONTENTS_HEX                     =
*   OBJECT_PARA                      =
*   OBJECT_PARB                      =
      receivers                        = gt_reclist
   EXCEPTIONS
     too_many_receivers               = 1
     document_not_sent                = 2
     document_type_not_exist          = 3
     operation_no_authorization       = 4
     parameter_error                  = 5
     x_error                          = 6
     enqueue_error                    = 7
     OTHERS                           = 8
Edited by: Krupaji on Oct 27, 2010 11:31 AM

Related FM SO_NEW_DOCUMENT_ATT_SEND_API1 you can check following example:
clear : gs_docdata,gt_objbin. "
    refresh : gt_objbin . "
*   gs_docdata-obj_name = 'ord_accept'.
    gs_docdata-obj_name = 'Invoice'.
    gs_docdata-expiry_dat = sy-datum + 10.
*   gs_docdata-obj_descr = 'Your Invoice No : '.
    gs_docdata-obj_descr = detail1.
    gs_docdata-sensitivty = 'F'. "Functional object
    gs_docdata-doc_size = gv_desc_lines * 255.
    clear gs_objpack-transf_bin.
* Start line of object header in transport packet
*    GS_OBJPACK-TRANSF_BIN = 'X'.
    gs_objpack-doc_size = gv_desc_lines * 255.
    gs_objpack-head_start = 1.
    gs_objpack-head_num = 0.
    gs_objpack-body_start = 1.
    gs_objpack-body_num = gv_desc_lines.
    gs_objpack-doc_type = 'RAW'.
*    GS_OBJPACK-OBJ_NAME = 'ORDER_ACCEPTANCE'.
*    GS_OBJPACK-OBJ_DESCR = 'ORDER_ACCEPTANCE.PDF'.
    append gs_objpack to gt_objpack.
  endif.
*• Passing the SAP Script text lines to SAPoffice: Single List with Column Length 255 table
  clear : gs_objbin, gs_pdf_tab.
*&      Encrypted file
  filename = name.
  if name is initial.
    concatenate   'd:\pdf\' main_dtl-vbeln '.PDF' into name.
  filename = name.
endif.
data: pdf type ref to cl_hrasr00_pdf_generation.
  data : lt_data            type solix_tab.
  open dataset filename for input in binary mode.
  if sy-subrc eq 0.
    read dataset filename into filex.
  endif.
  if filex is not initial.
    call function 'SCMS_XSTRING_TO_BINARY'
      exporting
        buffer        = filex
      importing
        output_length = file_length
      tables
        binary_tab    = gt_objbin.
  endif.
  close dataset filename.
describe table gt_objbin lines gv_tab_lines.
  clear gs_objbin.
  read table gt_objbin into gs_objbin index gv_tab_lines.
  if sy-subrc = 0.
    gs_objpack-doc_size = ( gv_tab_lines - 1 ) * 255 + strlen( gs_objbin ).
    gs_objpack-transf_bin = 'X'.
    gs_objpack-head_start = 1.
    gs_objpack-head_num = 0.
    gs_objpack-body_start = 1.
    gs_objpack-body_num = gv_tab_lines.
    gs_objpack-doc_type = 'PDF'.
    gs_objpack-obj_name = 'INVOICE'.
    gs_objpack-obj_descr = 'Invoice Order'.
    append gs_objpack to gt_objpack.
  endif.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    exporting
      document_data                    = gs_docdata
     put_in_outbox                    = 'X'
     commit_work                      = 'X'
* IMPORTING
*   SENT_TO_ALL                      =
*   NEW_OBJECT_ID                    =
    tables
      packing_list                     = gt_objpack
*   OBJECT_HEADER                    =  I_OBJTXT
     contents_bin                     = gt_objbin
     contents_txt                     = i_objtxt
*   CONTENTS_HEX                     =
*   OBJECT_PARA                      =
*   OBJECT_PARB                      =
      receivers                        = gt_reclist
   exceptions
     too_many_receivers               = 1
     document_not_sent                = 2
     document_type_not_exist          = 3
     operation_no_authorization       = 4
     parameter_error                  = 5
     x_error                          = 6
     enqueue_error                    = 7
     others                           = 8
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  else.
    open dataset name for input in binary mode.
    if sy-subrc eq 0.
      delete dataset filename.
    endif.

Similar Messages

  • PDF File opening error

    Hi,
    I have an BSP application in which I am fetching the pdf file data from an oracle table to a variable of data type xstring.
    Now I have to display this xstring again in pdf format in this BSP. The pdf file is generated but while opening it is giving error "There is an error in opening this document.The file is damaged and could not be repaired".
    What could be the reason.
    My On initialisation code is as:
    data: outputx type xstring.
    (The pdf file data is fetched from oracle table to outputx.)
    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg
    = 1.
        cached_response->set_header_field( name  =
              if_http_header_fields=>content_type
                                      value = 'application/pdf' ).
        cached_response->set_status( code = 200 reason = 'OK' ).
        cached_response->server_cache_expire_rel( expires_rel = 180 ).
        l_pdf_len = xstrlen( outputx ).
        response->set_data( data = outputx
                                 length = l_pdf_len ).
         response->set_header_field(
                            name  = 'content-disposition'
                            value = 'attachment; filename=attach_pdf.pdf' ).
    CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
        CONCATENATE runtime->application_url '/' guid '.pdf' INTO
    display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
      navigation->response_complete( ).

    Still the pdf file is not opening.
    My On Initilisation code is as below:
    EXEC SQL.
      OPEN CUR FOR SELECT ORDER_NO,ORDER_DESC,DOC_TYPE
                 FROM SAPIBM.T_ORDER
                 where ORDER_NO = :orderno
    ENDEXEC.
    refresh : t_order.
    do.
      clear : wk_order.
      EXEC SQL.
        FETCH NEXT CUR INTO
                         :wk_order-ORDER_NO,
                         :wk_order-ORDER_DESC,
                         :WK_ORDER-DOC_TYPE
      ENDEXEC.
      if sy-subrc = 0.
        append wk_order   to t_order.
      else.
        exit.
      endif.
    enddo.
    EXEC SQL.
      CLOSE CUR
    ENDEXEC.
    if not t_order[] is initial.
      read table t_order into wk_order index 1.
      w_doctype = wk_order-doc_type.
      case w_doctype.
        when 'P'.
    outputx = wk_order-order_desc.
    CREATE OBJECT cached_response TYPE CL_HTTP_RESPONSE EXPORTING add_c_msg
    = 1.
    IF XSTRLEN( OUTPUTX ) > 0.
    response->delete_header_field(
    name = if_http_header_fields=>cache_control ).
    response->delete_header_field(
    name = if_http_header_fields=>expires ).
    response->delete_header_field(
    name = if_http_header_fields=>pragma ).
    response->set_header_field(
    name = if_http_header_fields=>content_type
    value = 'application/pdf' ).
       response->set_status( code = 200 reason = 'OK' ).
       response->server_cache_expire_rel( expires_rel = 180 ).
        response->set_header_field(
                          name  = 'content-disposition'
                           value = 'attachment; filename=attach_pdf.pdf' )
        response->set_header_field(
                       name  = 'cache-control'
                       value = 'max-age=0' ).
        l_pdf_len = xstrlen( wk_order-order_desc ).
        response->set_data( data = wk_order-order_desc
                                 length = l_pdf_len ).
        CALL FUNCTION 'GUID_CREATE'
          IMPORTING
            ev_guid_32 = guid.
        CONCATENATE runtime->application_url '/' guid '.pdf' INTO
    display_url.
        cl_http_server=>server_cache_upload( url      = display_url
                                             response = cached_response ).
      navigation->response_complete( ).
    endif.
      endcase.
    endif.

  • HT1338 safari pdf file open error

    Dear. Sir
    I have recently downloaded Adobe Reader X, new version. I don't have any problem with this application when I open the stored pdf file in my mac.
    However, it has serious problem with opening a new pdf file on safari.
    When I download pdf files, the pdf document shows as a black....!!! (No respond at all from Safari)
    Please help me out
    Yours faithfully 
    Euna Noh

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • When I try to open a pdf file I get an error message stating "There was an error opening the document.  The file is damaged and could not be repaired."  Other pdf files open fine.

    When I try to open a pdf file I get an error message stating "There was an error opening the document.  The file is damaged and could not be repaired."  Other pdf files open fine.

    You need to get a new copy of the PDF.

  • I downloaded acrobat reader dc. after download completed, I could not open many PDF files. Error read: "could not open this file because its either not a supported file or because the file has been damaged". I opened a new user account and moved these fil

    I recently downloaded acrobat reader dc. After download was complete, I could not open PDF files. Error read "Adobe acrobat reader DC could not open this file because its either not a supported file or the file has been damaged". Any suggestions?

    HI davidd92392148,
    Is this error occurring for all PDF files that you try to open? There is an issue where all file icons can change to the PDF icon after installation, so is it possible that the files you're trying to open have been affected by this issue (and aren't actually PDF files)? Please see Application, file icons change to Acrobat/Reader icon.
    If that document isn't the key, then please tell us more about these files. Where are they stored? Did they open in previous versions of Reader?
    Best,
    Sara

  • How to change the font and size in the fillable field of an encrypted PDF file?

    hi!
    I’d like to change the font and size in the fillable field of an encrypted PDF file I-485 from www.uscis.gov/files/form/i-485.pdf
    I’m using Adobe Acrobat Pro 9 in Windows XP. I firstly tried Adobe LiveCycle Designer, but the I-485 file requires password to be opened, which I don’t know.
    Then I tried to print it to a PDF file, and use the Typewriter tool to fill in the form. But got error message while printing it to PDF file:
    This PostScript file was created from an encrypted PDF file.
    Redistilling encrypted PDF is not permitted.
    The I-485 file can be exported to unencrypted postscript file, but got the same error message while trying to open the ps file.
    I don’t know much about pdf file, can anyone please help?
    Thanks a lot!

    Ask the creator of the file for a unprotected version.

  • This PostScript file was created from an encrypted PDF file.

    I have a postscript file which has been created from secure or encrypted (opening restriction) pdf.
    Now when i use distiller to convert this postscript file to pdf then distiller cannot produce a pdf file.
    The log file contains following text:
    This PostScript file was created from an encrypted PDF file.
    Redistilling encrypted PDF is not permitted.
    %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
    %%[ Warning: PostScript error. No PDF file produced. ] %%
    1) Is there a way to convert this postscript file into pdf ?
    I have a limitation that i cannot remove security from secure pdf.
    2) Do distiller provide any settings which can be changed to convert
    this kind of ps(from secure pdf) to pdf.
    3) Can we provide password to distiller during process of conversion to
    pdf.
    4) If above methods do not work then is there a way we can
    programatically use Distiller Api's for conversion of postscript (in case
    of postscript created from secure pdf) to pdf
    Like methods 'FileToPdf' etc.
    Thanks in advance.

    I am facing a similar problem.
    My workflow dictates that I convert the input PDF job initially to PS and finally back to PDF. If the input PDF file is secure (it's not encrypted - you will still be able to open the document), the redistillation of PS to PDF fails while using Normalizer 6.0 && 9.0 libraries. If I use Normalizer 505 library, the redistillation succeeds. I have checked with the same generated PS on both Distiller 6.0 && 9.0, and both the versions fail to reconvert as well. I am a little surprised that 6.0 and 9.0 will fail to do something that 505 library manages.
    Any suggestions?

  • Index/catalog & encrypt PDF files

    Hi,
    I wish to archive thousands of PDF invoices. I can do this quite easily by putting them on a CD or DVD and creating a catalog Index... however I also wish to encrypt each document and password protect it. Again this is easily achieved by creating a batch process to add Security. When I have done this the catalogue index does not work anymore - it doesn't work either when I select "Encrypt all documents except metadata (acrobat 6 and later compatible)".
    Does anyone know how to index/catalog & encrypt PDF files?
    I use Vista SP1 & Acrobat pro Extended 9.0.0
    Thanks.
    Elfed.

    Right of course, I'm a little tired this morning.
    I copied over my new js file(s) to the C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Javascripts folder.
    Now that I have done that, I run the following code and get the error shown at the bottom:
     Type AcrobatCAcroAppType;AcrobatCAcroAppType =
    Type.GetTypeFromProgID("AcroExch.AVDoc"); 
    CAcroAVDoc avDoc = (Acrobat.CAcroAVDoc)Activator.CreateInstance(AcrobatCAcroAppType); 
    Type AcrobatPDDocType;AcrobatPDDocType =
    Type.GetTypeFromProgID("AcroExch.PDDoc"); 
    CAcroPDDoc pdDoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType); 
    try
     if (avDoc.Open(fileName, "")) //open the PDF
    pdDoc = (CAcroPDDoc)avDoc.GetPDDoc(); 
    Object jsAcroObj = pdDoc.GetJSObject(); 
    Type T = jsAcroObj.GetType(); 
    object[] saveAsParam = { "test" };T.InvokeMember(
    "TestFunction", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, jsAcroObj, saveAsParam); 
    Console.WriteLine("\tExport complete."); 
    if (avDoc.Close(1) != true) avDoc.Close(1);}
    else Console.WriteLine("Cannot open: " + fileName);}
    catch (Exception ex){
    Console.WriteLine(ex);}
    Code fails at
    T.InvokeMember line with the following error:
    System.Runtime.InteropServices.COMException (0x80020006): Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))

  • Encrypted pdf file

    Hi,
    I received pdf file to my email, when i open it on my iphone the pages were blanks (White) i ask the sender to resend me the file as I thought there is some error sending it, but again the same, when i went home i open the file on mac and it is asked me for a password, then it is open and both files were fine,
    So please any one know how to open encrypted pdf file on iPhone ????

    Apparently you cannot. Sorry.

  • Why won't some pdf-files open on tablet/phone?

    I simply get the error saying: The document cannot be opened because it's not a valid pdf-document.
    However I have no problems opening the file with my laptop, only my phone and tablet (Jellybean 4.2.2) won't open it.
    My friends also have managed to open the file on their tablets (android/windows).
    Have reinstalled and checked updates and tried other programs but none has worked for me.
    I simply have no clue and would appreciate help.

    Hey,
    Seems like the problem was in the web browser I was using, as the file just
    didn't download correctly.
    Thanks for the help anyway, much appreciated.
    Tuomo
    2014-10-15 1:03 GMT+03:00 Tuomo Stenberg <[email protected]>:
    Hey,
    spent some time discussing this with some friends of mine and found out
    that the document can be opened by downloading it to the computer and
    transferring then to the tablet or phone. The difference is that when
    downloading with tablet/phone I get a .pdf file, which only has some html
    code. So I guess the problem has something to do with the encryption of the
    file. Here are the 2 different files I get as attachments. After all this
    might not have anything to do with adobe, but some other stuff I don't
    really understand.
    Tuomo
    2014-10-14 22:26 GMT+03:00 Romil Mittal <[email protected]>:
    >>     Why won't some pdf-files open on tablet/phone?  created by Romil
    >> Mittal <https://forums.adobe.com/people/Romil+Mittal> in *Adobe Reader
    >> for Android* - View the full discussion
    >> <https://forums.adobe.com/message/6825723#6825723>
    >>

  • How to fix the .pdf file with error "invalid annotation object"

    how to fix the .pdf file with error "invalid annotation object"

    As long as the PDF opens, then just try saving it to a new file name. There may be a preflight script that would help troubleshoot the issue.

  • Why can't I scroll or use MMB to open pages in new tab, when I have a PDF file opened in FF4?

    If I have a PDF file opened in firefox 4, I am for unknow reason unable to open pages in new tabs with MMB or scroll thepage up or down. The scroll function isn't working at all, and it seems like I'd be scrolling the PDF file, not the page of my current tab.

    Hi aK'
    Nice, memorable user name!
    -1712 is a timed out error. One reported cause (with other applications) is that the application is attempting to open a large number of files, or a file that no longer exists.
    Try holding down the shift key when launching preview. This prevents the application from attempting to open windows that were not closed before quitting the application.
    Regards,
    Barry

  • How secure is an encrypted pdf file?

    I am using Acrobat XI Pro => Require a password to open document => use a password that is 'Best' with the 4 gray rectangles on the right lighting up green => Compatibility: Acrobat X and later, Encryption Level: 256-AES
    In other words, the above is the strongest security that Acrobat XI Pro has to offer by way of encryption. But just how secure is this strongest security? Any of the experts here care to give a lay person a feel for the level of security in case the encrypted pdf file gets in the wrong hands?

    It would be very hard (take a very long average amount of time) to crack the security with that password and encryption level, but both the "document open" and "change security" passwords should have the same high level of strength since both can be used to open the document. Be sure to use passwords that aren't susceptible to dictionary attacks.
    Check out this site: https://www.grc.com/haystack.htm
    but read the background information so you know what it's showing.

  • Using browser javascript to copy selected text from a pdf file opened in Air app.

    I have posted this question on reader forum as well, but I think it is more suited here...
    I am trying to create a note-taking application in air. I want to extract selected text from pdf file as a string object or to the clipboard.
    Obviously, all pdfs in my local storage will not be scripted to recieve postMessages and act accordingly, and that is not practical either. So, my problem is, how can I copy the selected text in the pdf file (opened as an object in htmlloader within my Air app) to clipboard or directly in another control by say clicking a button in air application? I suppose, this is possible using javascript, however, I don't know which reader methods are exposed to the wrapper htmlloader control. In short, I want to execute app.execMenuItem("Copy") command through htmlloader javascript. Any alternate solutions are also welcome.
    This is similar to passing inbuilt commands/methods/functions (of adobe reader) to pdf-reader plugin embedded in a webpage via javascript. This is possible in IE where the pdf is rendered as activex object, and hence JSObject interface of pdf document/reader is accessible to the browser javascript. I have also read that this same JSObject is accessible to VB as interface for IAC, so as the Air is Adobe's own product, I was wondering if equivalent of JSObject is accessible to htmlloader control as well.
    Thanks in advance...
    Mits

    Thank you Thom for your reply...
    from
    http://www.adobe.com/devnet/acrobat/javascript.html
    ...Through JavaScript extensions, the viewer application and its plug-ins expose much of their functionality to document authors, form designers, and plug-in developers...
    As it is explicitly mentioned, that the functionality of adobe reader are exposed for plugin development, I thought someone here might have used external javascript to execute some safe methods in adobe reader. The functionality (i.e. external javascript interface-JSObject) is already available for VB programmers to develop IAC. Further, the Acrobat SDK example called "AcroPDFinHML" shows how one can embed a pdf-reader in a html page and execute some safe methods (like gotonextpage(), zooming etc.) in IE as ActiveX plugin. I have checked it myself for adobe reader 9, and it works perfectly, so there is no security issue as such to implement the same for another browser (like in my case, the htmlloader control in flex/air app).
    I intend to create a note taking application in air, where it is very much required that I should be able to copy selected text from various pdf documents, that are open in my app, and subsequently paste/collect/save the collected notes and process them afterwords (offcourse, from the pdfs that allow me copying text). However, it is not happening for me here. As the pdfs are opened through adobe reader plugin, it does not register the copy command executed by my air app. It registers the system level copy command (by keyboard shortcut Ctrl+C), but my air app has no way to execute the system level copy command programmatically. So I am kind of stuck here...
    Thanks again for your reply. Having known what am I intend to accomplish, any other (may be alternative) solutions will be appreciated nonetheless...
    Mits

  • File opening error

    hello friends,
    i am doing data migration with lsmw withe directinput method so i did everything fine till the end i defined the logicalfiles also correctly and defined everthing perfeclty
    but i am getting below error
    File open error
    belrd110\INPUT\CT.TXT Permission  denied
    can anyone let me know where this is going wrong
    i am having the authorisation at the server level also and in the read and convert steps records and data coming perfectly but when i excute it at the end it is giving such error
    ur help will be appreciated
    Naveen

    Hi Naveen,
    Did you write your statment like this?
    OPEN DATASET P_DOWN FOR OUTPUT IN TEXT MODE.
    If it is not working, try to create a new file and access the same.
    Thanks,
    Sreekanth

Maybe you are looking for