File is damaged and could not be repaired, when emailed the PDF Document

Hi i have the same problem , that what you have resolved, but it doesn't work for me...
i.e, when i sent a mail from the below code , mail sent but when open it shows "**There was an error in opening this document. the file is damaged and could not be repaired."**
can u please suggest to over come this problem.. and i m using IBM Websphere 8.
please advice ....
thanks alot in advance...
here is the code :
AstLogger logger = AstLogger.getInstance();
logger.info(this.getClass(),"ReportBuilderUtils.sendMail Start....");
boolean flag = false;
try {
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.mail.Session session = (javax.mail.Session) ctx.lookup(AstProps.getInstance().getWebCollectLoginMailSession());
Message msg = new MimeMessage(session);
InternetAddress addressFrom = new InternetAddress(from);
logger.info(this.getClass(), "Report Builder Utils - Email From :" + from);
msg.setFrom(addressFrom);
String log = "";
double tempFilesize=0;
for(String emailId : recipients) {
InternetAddress addressTo = new InternetAddress(emailId);
msg.addRecipient(Message.RecipientType.TO, addressTo);
log += emailId + ",";
logger.info(this.getClass(), "Report Builder Utils - Email Recipients :" + log);
// Setting the Subject and Content Type
msg.setSubject(subject);
logger.info(this.getClass(), "Report Builder Utils - Email Subject :" + subject);
msg.setContent(message, "text/plain");
msg.setHeader("Content-Type", "multipart/mixed");
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(message);
logger.info(this.getClass(), "Report Builder Utils - Email Message :" + message);
mbp1.setDataHandler(new DataHandler(new HTMLDataSource(message)));
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
// constants to handle the large files
if(tempFile.exists()){
tempFilesize = tempFile.length();
logger.info(this.getClass(), "Report Builder Utils - File Size :" +((tempFilesize/(1024*1024))) +"MB.");
System.out.println("ATTACHMENT_SIZE ==>" +ATTACHMENT_SIZE);
if(tempFilesize > ATTACHMENT_SIZE){
flag = false;
return flag;
MimeBodyPart mbp_file = new MimeBodyPart();
mbp_file.setHeader("Content-Type", "application/pdf");
mbp_file.setHeader("Content-Transfer-Encoding", "Base64");
mbp_file.setFileName(fileName);
mbp_file.setDisposition(Part.ATTACHMENT);
mbp_file.setDataHandler(new DataHandler(new FileDataSource(tempFile)));
mp.addBodyPart(mbp_file);
System.out.println("Mail Successfully sent to :"+recipients);
msg.saveChanges();
msg.setContent(mp);
// even tried by placing here
// mbp_file.setHeader("Content-Transfer-Encoding", "base64"); base64 is not case-sensitive i hope , i read out on some books
Transport.send(msg);
logger.info(this.getClass(), "Report Builder Utils - Email Send successfully...");
flag = true;
}catch (Exception e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
logger.error(this.getClass(), sw.toString());
AstLogger.getInstance().info(this.getClass(),"ReportBuilderUtils.sendMailAsAttachment End.");
return flag;
Edited by: 992445 on Mar 7, 2013 4:05 AM

You need to get a new copy of the PDF.

Similar Messages

  • The file is damaged and could not be repaired when smartforms convert to pdf

    i m using your code but error is occur
    please  help me
    when i goto sost and open my pdf file at that time give error message
    my whole program is below
    report  ypayment_advice2.
    tables : bsak,skat.
    types : begin of t_bsak,
           belnr type bsak-belnr,
           gjahr type bsak-gjahr,
           augbl type bsak-augbl,
           augdt type bsak-augdt,
           xblnr type bsak-xblnr,
           bldat type bsak-bldat,
    *      DMBTR TYPE BSAK-DMBTR,
    *      WAERS TYPE BSAK-WAERS,
           lifnr type bsak-lifnr,
           saknr type bsak-saknr,
           budat type bsak-budat,
    *      EBELN TYPE BSAK-EBELN,
    *      EBELP TYPE BSAK-EBELP,
           bukrs type bsak-bukrs,
           buzei type bsak-buzei,
           ebeln type bseg-ebeln,
           ebelp type bseg-ebelp,
           hkont type bseg-hkont,
           shkzg type bseg-shkzg,
           werks type bseg-werks,
           dmbtr type bseg-dmbtr,
           bldat1 type bsak-bldat,
           xblnr1 type bsak-xblnr,
    end of t_bsak.
    types : begin of t_bseg,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             ebeln type bseg-ebeln,
             ebelp type bseg-ebelp,
             hkont type bseg-hkont,
             shkzg type bseg-shkzg,
             werks type bseg-werks,
             dmbtr type bseg-dmbtr,
    end of t_bseg.
    types : begin of t_bseg2,
             belnr type bseg-belnr,
             gjahr type bseg-gjahr,
             ebeln type bseg-ebeln,
             ebelp type bseg-ebelp,
             werks type bseg-werks,
      end of  t_bseg2.
    types : begin of t_bseg1,
             augbl type bseg-augbl,
             gjahr type bseg-gjahr,
             hkont type bseg-hkont,
    end of t_bseg1.
    types : begin of t_bkpf,
             bukrs type bkpf-bukrs,
             cpudt type bkpf-cpudt,
             blart type bkpf-blart,
             usnam type bkpf-usnam,
             budat type bkpf-budat,
    end of t_bkpf.
    types : begin of t_bsak1,
             lifnr type bsak-lifnr,
    end of t_bsak1.
    *DATA : IT_FINAL TYPE STANDARD TABLE OF T_FINAL WITH HEADER LINE.
    *DATA : WA_FINAL TYPE T_FINAL.
    data : wrk_answer type c.
    data : it_bsak type standard table of t_bsak.
    data : wa_bsak type t_bsak.
    data : it_bsak_temp type standard table of t_bsak1 with header line,
            wa_bsak_temp type      t_bsak1.
    data : it_bsak_temp1 type standard table of t_bsak1 with header line,
            wa_bsak_temp1 type      t_bsak1.
    data : it_bsak1 type standard table of t_bsak.
    data : wa_bsak1 type t_bsak.
    data : it_bseg type standard table of t_bseg.
    data : wa_bseg type t_bseg.
    data : it_bseg1 type standard table of t_bseg1.
    data : wa_bseg1 type t_bseg1.
    data : it_bseg2 type standard table of t_bseg2.
    data : wa_bseg2 type t_bseg2.
    data : it_bkpf type standard table of t_bkpf.
    data : wa_bkpf type t_bkpf.
    data : l_cntr type i value 1.
    data : op type ssfcompop.
    data : control type ssfctrlop.
    data: formname1  type  tdsfname," value 'YPAYMENT_ADVICE',
           fm_name    type  rs38l_fnam.
    data : i_smtp_addr type adr6-smtp_addr,
              i_adrnr     type lfa1-adrnr.
    data: gd_recsize type i.
    data : it_tsp01 type standard table of tsp01 with header line .
    data : it_pdf like tline occurs 0 with header line .
    data : gd_buffer type string.
    data: gd_spool_nr like tsp01-rqident,
           gd_destination like rlgrap-filename,
           gd_bytecount like tst01-dsize.
    data: gd_subject   like sodocchgi1-obj_descr,
          it_mess_bod like solisti1 occurs 0 with header line,
          it_mess_att like solisti1 occurs 0 with header line,
          gd_sender_type     like soextreci1-adr_typ,
          gd_attachment_desc type so_obj_nam,
          gd_attachment_name type so_obj_des.
    data : w_emailid type adr6-smtp_addr.
    *  JOB RUNTIME PARAMETERS
    data: gd_eventid like tbtcm-eventid,
         gd_eventparm like tbtcm-eventparm,
         gd_external_program_active like tbtcm-xpgactive,
         gd_jobcount like tbtcm-jobcount,
         gd_jobname like tbtcm-jobname,
         gd_stepcount like tbtcm-stepcount,
         gd_error    type sy-subrc,
         gd_reciever type sy-subrc.
    data: t_otfdata type soli_tab,
           t_otfdata_item type soli_tab,
           t_objhex type solix_tab,
           t_objhead type soli_tab,
           w_transfer type sx_boolean,
           w_length type sood-objlen,
           w_length_item type sood-objlen,
           w_lines_txt type i,
           w_lines_bin type i,
           wa_soli type soli,
           wa_solix type solix,
           w_doc_chng type sodocchgi1,
           t_objcont type standard table of soli with header line,
           t_objcont_item type standard table of soli with header line,
           t_objpack like sopcklsti1 occurs 0 with header line,
           t_reclist like somlreci1 occurs 0 with header line,
           t_objtxt like solisti1 occurs 0 with header line.
    data : ls_control type ssfctrlop,
            ls_output  type ssfcrescl,
            ls_output_opt type ssfcompop,
            lt_lines  type table of tline,
            lt_linesx  type table of tdline.
    data : lv_pdf type xstring,
            lv_filelen type i,
            lv_file type string.
    selection-screen begin of block b1 with frame title text-001.
    select-options : p_lifnr for bsak-lifnr.
    select-options : p_augbl for bsak-augbl obligatory,
                      p_year for bsak-gjahr obligatory.
    *                 P_BUDAT FOR BSAK-BUDAT.
    selection-screen end of block b1.
    start-of-selection.
       perform get_data.
       perform process_data .
       perform call_smartforms.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form get_data .
       select augbl  gjahr budat xblnr
         from bsak
         into corresponding fields of table it_bsak1
         where augbl in p_augbl
           and gjahr in p_year
           and blart = 'KZ'
           and lifnr  in p_lifnr.
       if sy-subrc <> 0.
         message 'No Record Found ' type 'E'.
       endif.
       select augbl augdt belnr gjahr xblnr
                dmbtr lifnr saknr budat bukrs buzei
             from bsak
           into corresponding fields of table it_bsak
           for all entries in it_bsak1
           where augbl = it_bsak1-augbl
             and augdt = it_bsak1-budat
             and blart = 'RE'.
    *    FOR ALL ENTRIES IN IT_BSAK
    *    WHERE AUGBL = '1500000011' "IT_BSAK-AUGBL
    *      AND GJAHR = '2013' "IT_BSAK-GJAHR
    *      AND BLART = 'RE'.
       select belnr gjahr shkzg dmbtr koart
          from bseg
          into corresponding fields of table it_bseg
          for all entries in it_bsak
          where belnr = it_bsak-belnr
            and gjahr = it_bsak-gjahr
            and koart = 'K'.
    *       AND BUKRS = IT_BSAK-BUKRS.
    *       AND BUZEI = IT_BSAK-BUZEI.
       select belnr gjahr hkont
        from bseg
        into corresponding fields of table it_bseg1
           for all entries in it_bsak1
           where belnr = it_bsak1-augbl
             and gjahr = it_bsak1-gjahr
             and koart = 'S'.
       select  belnr gjahr ebeln ebelp werks
         from bseg
         into corresponding fields of table it_bseg2
            for all entries in it_bseg
            where belnr = it_bseg-belnr
              and gjahr = it_bseg-gjahr
              and buzid = 'W'.
    *  BREAK ABAP.
       select bukrs cpudt blart usnam budat
         from bkpf
         into corresponding fields of table it_bkpf
         for all entries in it_bsak
         where belnr = it_bsak-belnr
           and gjahr = it_bsak-gjahr.
    *      AND BUKRS = IT_BSAK-BUKRS
       loop at it_bsak into wa_bsak.
         read table it_bseg into wa_bseg with key belnr = wa_bsak-belnr
                                                  gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg-shkzg to wa_bsak-shkzg.
           move wa_bseg-dmbtr to wa_bsak-dmbtr.
           modify it_bsak from  wa_bsak transporting shkzg dmbtr.
         endif.
         read table it_bseg2 into wa_bseg2 with key belnr = wa_bsak-belnr
                                                    gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg2-ebeln to wa_bsak-ebeln.
           move wa_bseg2-ebelp to wa_bsak-ebelp.
           move wa_bseg2-werks to wa_bsak-werks.
           modify it_bsak from  wa_bsak transporting ebeln ebelp werks .
         endif.
         read table it_bseg1 into wa_bseg1 with key gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bseg1-hkont to wa_bsak-hkont.
           modify it_bsak from  wa_bsak transporting hkont where gjahr = wa_bsak-gjahr.
         endif.
         read table it_bsak1 into wa_bsak1 with key augbl = wa_bsak-augbl
                                                    gjahr = wa_bsak-gjahr.
         if sy-subrc = 0.
           move wa_bsak1-bldat to wa_bsak-bldat1.
           move wa_bsak1-xblnr to wa_bsak-xblnr1.
           modify it_bsak from  wa_bsak transporting bldat1 xblnr1 where augbl = wa_bsak-augbl
                                                                    and  gjahr = wa_bsak-gjahr.
         endif.
       endloop.
       loop at it_bsak into wa_bsak.
         move wa_bsak-lifnr to wa_bsak_temp-lifnr.
         append wa_bsak_temp to it_bsak_temp  .
       endloop.
       loop  at it_bsak_temp into wa_bsak_temp.
         collect wa_bsak_temp into it_bsak_temp1.
       endloop.
    endform.                    " GET_DATA
    *&      Form  PROCESS_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form process_data .
       export it_bsak to memory id 'IT_BSAK'.
       export it_bseg to memory id 'IT_BSEG'.
       export it_bkpf to memory id 'IT_BKPF'.
    *  BREAK ABAP.
    endform.                    " PROCESS_DATA
    *&      Form  CALL_SMARTFORMS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form call_smartforms .
    *  LOOP AT IT_BSAK_TEMP.
       call function 'SSF_FUNCTION_MODULE_NAME'
         exporting
           formname = 'YPAYMENT_ADVICE1'
         importing
           fm_name  = fm_name.
    *    CALL FUNCTION FM_NAME"'/1BCDWB/SF00000442'
    *      EXPORTING
    *         P_LIFNR                   = IT_BSAK_TEMP-LIFNR.
       call function fm_name"'/1BCDWB/SF00000442'
         exporting
             it_bsak                    = it_bsak
             it_bseg                    = it_bseg
             it_bkpf                    = it_bkpf.
       clear wrk_answer.
    *  BREAK ABAP.
       call function 'POPUP_TO_CONFIRM'
         exporting
         titlebar                    = 'LOGOFF'
    *           DIAGNOSE_OBJECT         = ' '
           text_question             = 'Do You Want Send Mail?'
          text_button_1              = 'YES'
    *           ICON_BUTTON_1           = ' '
          text_button_2              = 'NO'
          display_cancel_button      = space
          start_column               = 25
          start_row                  = 6
        importing
          answer                     = wrk_answer
    *         TABLES
    *           PARAMETER               =
        exceptions
          text_not_found             = 1
          others                     = 2
       if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       endif.
    *Mail send coding
       check wrk_answer = '1'.
       loop at it_bsak_temp1 into wa_bsak_temp1.
         break abap.
         select single adrnr from lfa1
             into i_adrnr where lifnr = wa_bsak_temp1-lifnr.
         select single smtp_addr from adr6
         into w_emailid
         where addrnumber = i_adrnr.
         if w_emailid is not initial.
           perform mail.
         else.
           message 'E-Mail Address is not maintained for Vendor' type 'S'.
         endif.
       endloop.
    endform.                    " CALL_SMARTFORMS
    *&      Form  SEND_EMAIL
    *       text
    *      -->P_P_EMAIL1  text
    form send_email  using    p_email.
       check not ( p_email is initial ).
       refresh it_mess_bod.
    *BREAK-POINT.
    *   DEFAULT SUBJECT MATTER
       gd_subject         = 'SUBJECT'.
       gd_attachment_desc = 'Invoice  '.
    *    CONCATENATE 'ATTACH_NAME' ' ' INTO GD_ATTACHMENT_NAME.
       it_mess_bod        = 'Hi,'.
       append it_mess_bod.
       it_mess_bod = 'Kindly Find an attached copy of Sale Invoice : '.
       concatenate it_mess_bod p_lifnr into it_mess_bod separated by space.
       append it_mess_bod.
       it_mess_bod        = 'This is system generated Mail,So do not reply.'
       append it_mess_bod.
       it_mess_bod        = 'Thank you,'.
       append it_mess_bod.
       it_mess_bod        = 'Gokul Refoils & Solvent Ltd.'.
       append it_mess_bod.
       data : p_sender type somlreci1-receiver.
       p_sender = '[email protected]'
    *   IF NO SENDER SPECIFIED - DEFAULT BLANK
       if p_sender eq space.
         gd_sender_type  = space.
       else.
         gd_sender_type  = 'INT'.
       endif.
    *   SEND FILE BY EMAIL AS .XLS SPEADSHEET
       perform send_file_as_email_attachment
                                    tables it_mess_bod
                                           it_mess_att
                                     using p_email
    'Narendra CHECK Invoice-Gokul Refoils & Solvent Ltd.'
    *'Sale Invoice .pdf document attached'
                                           'PDF'
                                           gd_attachment_name
                                           gd_attachment_desc
                                           p_sender
                                           gd_sender_type
                                  changing gd_error
                                           gd_reciever.
    endform.                    " SEND_EMAIL
    *  &      FORM  SEND_FILE_AS_EMAIL_ATTACHMENT
    *         TEXT
    *        -->P_IT_MESS_BOD  TEXT
    *        -->P_IT_MESS_ATT  TEXT
    *        -->P_P_EMAIL  TEXT
    *        -->P_1395   TEXT
    *        -->P_1396   TEXT
    *        -->P_GD_ATTACHMENT_NAME  TEXT
    *        -->P_GD_ATTACHMENT_DESC  TEXT
    *        -->P_P_SENDER  TEXT
    *        -->P_GD_SENDER_TYPE  TEXT
    *        <--P_GD_ERROR  TEXT
    *        <--P_GD_RECIEVER  TEXT
    form send_file_as_email_attachment  tables   it_message
                                                 it_attach
                                        using    p_email
                                                 p_mtitle
                                                 p_format
                                                 p_filename
                                                 p_attdescription
                                                 p_sender_address
                                                 p_sender_addres_type
                                        changing perror
                                                 p_reciever.
       data:ld_error    type sy-subrc,
           ld_reciever type sy-subrc,
           ld_mtitle like sodocchgi1-obj_descr,
           ld_email like  somlreci1-receiver,
           ld_format type  so_obj_tp ,
           ld_attdescription type  so_obj_nam ,
           ld_attfilename type  so_obj_des ,
           ld_sender_address like  soextreci1-receiver,
           ld_sender_address_type like  soextreci1-adr_typ,
           ld_receiver like  sy-subrc.
       data:   t_packing_list like sopcklsti1 occurs 0 with header line,
               t_contents like solisti1 occurs 0 with header line,
               t_receivers like somlreci1 occurs 0 with header line,
               t_receivers1 like somlreci1 occurs 0 with header line,
               t_attachment like solisti1 occurs 0 with header line,
               t_object_header like solisti1 occurs 0 with header line,
               w_cnt type i,
               w_sent_all(1) type c,
               w_doc_data like sodocchgi1.
       ld_email  = p_email.
       ld_mtitle = p_mtitle.
       ld_format = p_format.
       ld_attdescription = p_attdescription.
       ld_attfilename    = p_filename.
       ld_sender_address = p_sender_address.
       ld_sender_address_type = p_sender_addres_type.
    *   FILL THE DOCUMENT DATA.
       w_doc_data-doc_size = 1.
    *   POPULATE THE SUBJECT/GENERIC MESSAGE ATTRIBUTES
       w_doc_data-obj_langu = sy-langu.
       w_doc_data-obj_name  = 'SAPRPT'.
       w_doc_data-obj_descr = ld_mtitle .
       w_doc_data-sensitivty = 'F'.
    *   FILL THE DOCUMENT DATA AND GET SIZE OF ATTACHMENT
    *BREAK-POINT.
       clear w_doc_data.
       read table it_attach index w_cnt.
       w_doc_data-doc_size =
          ( w_cnt - 1 ) * 255 + strlen( it_attach ).
       w_doc_data-obj_langu  = sy-langu.
       w_doc_data-obj_name   = 'SAPRPT'.
       w_doc_data-obj_descr  = ld_mtitle.
       w_doc_data-sensitivty = 'F'.
       clear t_attachment.
       refresh t_attachment.
       t_attachment[] = it_attach[].
    *   DESCRIBE THE BODY OF THE MESSAGE
       clear t_packing_list.
       refresh t_packing_list.
       t_packing_list-transf_bin = space.
       t_packing_list-head_start = 1.
       t_packing_list-head_num = 0.
       t_packing_list-body_start = 1.
       describe table it_message lines t_packing_list-body_num.
       t_packing_list-doc_type = 'RAW'.
       append t_packing_list.
    *   CREATE ATTACHMENT NOTIFICATION
       t_packing_list-transf_bin = 'X'.
       t_packing_list-head_start = 1.
       t_packing_list-head_num   = 1.
       t_packing_list-body_start = 1.
       describe table t_attachment lines t_packing_list-body_num.
       t_packing_list-doc_type   =  ld_format.
       t_packing_list-obj_descr  =  ld_attdescription.
       t_packing_list-obj_name   =  ld_attfilename.
       t_packing_list-doc_size   =  t_packing_list-body_num * 255.
       append t_packing_list.
    *   ADD THE RECIPIENTS EMAIL ADDRESS
       clear t_receivers.
       refresh t_receivers.
       t_receivers-receiver = w_emailid.
       t_receivers-rec_type = 'U'.
       t_receivers-com_type = 'INT'.
       t_receivers-notif_del = 'X'.
       t_receivers-notif_ndel = 'X'.
       append t_receivers.
    **  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    **    EXPORTING
    **      DOCUMENT_DATA              =  W_DOC_DATA
    **      PUT_IN_OUTBOX              = 'X'
    **      COMMIT_WORK                = 'X'
    **    TABLES
    **      PACKING_LIST               = T_PACKING_LIST
    **      CONTENTS_BIN               = T_ATTACHMENT
    **      CONTENTS_TXT               = IT_MESSAGE
    **      RECEIVERS                  = T_RECEIVERS
    **    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.
    **  COMMIT WORK.
    **  LOOP AT T_RECEIVERS.
    **    LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
    **  ENDLOOP.
    **ENDFORM.                    "SEND_FILE_AS_EMAIL_ATTACHMENT
       call function 'SO_DOCUMENT_SEND_API1'
         exporting
           document_data              = w_doc_data
           put_in_outbox              = 'X'
           sender_address             = ld_sender_address
           sender_address_type        = ld_sender_address_type
           commit_work                = 'X'
         importing
           sent_to_all                = w_sent_all
         tables
           packing_list               = t_packing_list
           contents_bin               = t_attachment
           contents_txt               = it_message
           receivers                  = t_receivers
         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.
    *   POPULATE ZERROR RETURN CODE
       ld_error = sy-subrc.
    *   POPULATE ZRECEIVER RETURN CODE
       loop at t_receivers.
         ld_receiver = t_receivers-retrn_code

    Not sure if the flollowing will be of use, but worth a try?…
    Try changing the .ai to .eps or .pdf to see if anything happens to see if it makes a difference to importing or exporting as a pdf?
    If you have Indesign, try importing the file into Indesign then saving that file as a pdf or/and export as a Indesign eps file.
    Sorry I cannot be of any more assistance.
    Good luck!

  • "The file is damaged and could not be repaired" error when trying to open a PDF in Reader

    A few of our employess (only 3 out of over 100 so far) have been getting the error, "The file is damaged and could not be repaired" when trying to open some PDFs. Other people are able to open the same PDF files with no error. It's happening on about 10% of the time. I've read a bunch of threads here with this isue and tried some suggested fixes and nothing has resolved the issue. Here is what I have found works and does not work and the info on their computers:
    Computers:
    1 Dell Vostro desktop running WIndows 7
    1 Toshiba Satellite C55 runnign Windows 8
    1 Samsung ATIV Book 4 running Windows 8
    All using Adobe Reader XI but we did uninstall that version and tried previous versions and still got the error.
    Did Not Work:
    As suggested by the company that we use online for claims adjustments where this error is occuring, we tried using a different PDF creator since the files were created using a free PDF creator by the employees. PDF995 and PDFcreator (pdfforge) did not resolve the issue. I then created the PDFs with my Adobe Acrobat, uploaded from my computer to the online program, and that did not resolve the issue.
    Saving the file to hard drive and then opening in Adobe did not work.
    Turning off Protected Mode and Enhanced Security did not work.
    Compatibility View settings enabled in Internet Explorer 10 did not resolve the issue. The previously mentioned claims adjustment software company we use online was code for IE so is not fully compatible with other browsers.
    That being said I did try to open the PDF files in Chrome and it also did not work. Same error message.
    Does work:
    I download the file they cannot open onto my hard drive, open in Adobe Acrobat, Save as a pdf, then email it to them and they can open it via email attachment.
    If they close the error and continue trying to open the file over and over sometimes it will eventually open.
    Is there a setting in Windows that is preventing them from opening a small % of files some of the time? Thanks in advance for any help!
    James

    If anyone is reading this still looking for what caused the issue and how to fix it here is what I discovered.
    The antivirus program our company uses, Bitdefender Antivirus Plus, was causing some of the PDF files not to open. After troubleshooting the different modules and settings the culprit was..
    Scan SSL in Privacy Control Settings. Turning it OFF solved the problem and all the PDF files that previously would not open now open just fine. This issue has been sent to Bitdefender for them to review. If you use a different antivirus program and are having this issue try locating the Scan SSL setting and see if turning it off solves the problem.

  • When I attempt to open a PDF file I saved from a website, I get the message "There was an error opening this document. The file is damaged and could not be repaired." Is there any way to correct this problem?

    When I attempt to open a PDF file I saved from a website using Safari, I get the message "There was an error opening this document. The file is damaged and could not be repaired." When I save the same PDF file using FireFox it opens up immediately. Is there any way to correct this problem with Safari?

    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.

  • With OSX10.7.5 and Adobe Reader 11.0.02 when I try to open a PDF downloaded from the web I get 'There was an error opening this document. This file is damaged and could not be repaired. Preview will not open either. Older PDFs OK.

    I am running OS X 10.7.5 and Adobe Reader 11.0.02. In the last few days I have been unable to open PDF's downloaded from the web. Reader gives the error message 'There was an error opening this document. The file is damaged and could not be repaired'. Removing Reader and trying to use Preview to open these files give the error 'Preview cannot open this file. It may be damaged or use a file format that Preview doesn't recognise' (or something like that). Downloading the same files with Reader removed from my Mac Preview opens the files OK.
    I was recently prompted to update Adobe software but did not note exactly what the update was nor when it was done.
    Reader and Preview will both open PDFs I downloaded a week ago. Reader will also open files downloaded on another Mac running OS X 10.0.0 and copied to my Mac. Any ideas?

    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.

  • I keep getting the message, "the file is damaged and could not be repaired"

    I have a newer Gateway PC equipped with Windows Vista Ultimate, and recently downloaded the free Adobe Reader 8.1.1 version to it.
    I'm not very computer literate, so I'm not sure which terminology to use all the time...sorry.
    When I attempt to open (view, read, download?) a pdf file, it starts the download process, showing the progress at the bottom of the page....for example, it might say, "downloading (16.2kb out of 543.5kb)"
    Usually, about a minute or so into the download, the word "downloading" changes to "downloaded", the action stops, and shortly after (on the window with the gray Adobe Reader background), a smaller message window pops up, declaring, "the file is damaged and could not be repaired".
    A friend suggested that there was probably a problem with the original downloading of Reader and recommended that I completely remove it from my system, then re-install it. Reluctantly, with a very slow dial-up connection network, I did as he suggested, then painfully sat through about a two-hour download AGAIN of Reader 8.1.1
    After the download was completed again, I successfully opened a few of the pdf files which I was previously having the problems with. Problem solved??? NOT QUITE!!! After about three or four successful file downloads (openings/readings of the files), it again started to do the same thing, where it would not complete the downloading/opening process and again leaving the message, "the file is damaged and could not be repaired."
    I am very confident that the files are not the problem, as many of my friends have viewed/opened those same pdf files repeatedly with no issues, BUT WHAT IS CAUSING THIS??? As I said before, I'm not very computer savvy as it is, and adding the newer Windows Vista Ultimate OS probably hasn't helped any.
    1. Is the problem with Windows Vista?
    2. Is the problem with Adobe Reader 8.1.1 (or the downloading of it)?
    3. Is the problem related to the security settings of my computer?
    4. Is the problem likely virus related (I use the purchased McAfee protection)?
    I just don't know where or how to start looking for the solution, other than thru this forum, and I simply can't afford the time to remove and re-install Adobe Reader 8.1.1 each time I need the use of my computer.
    Any assistance would be greatly appreciated, and you can e-mail me with suggestions to [email protected], or else call me on my cell
    THANK YOU,
    Don Maycumber
    Republic, WA
    509-570-8114 Verizon mobile

    I'm having the same problem but with high speed access.
    Anyone know the answer?
    ~Chris

  • There was an error opening this document.  The file is damaged and could not be repaired.

    Good Day all
    When busy doing internet banking on www.absa.co.za and I try to print a confirmation, I get the following error message: "C:\Documents and Settings\%user profile%\Local Settings\Temporary Internet Files\Content.IE5\%folder name%\%file name%.pdf
    Could not open file.
    File not found."
    I've managed to locate the actual file that it's looking for, but when I try and open the file using either Adobe or Foxit Reader, I get the following error message: "There was an error opening this document. The file is damaged and could not be repaired."
    I've un-installed Adobe and installed version 9.1 for this particular user. This happened a while ago and then an un-installation and re-installation of Adobe solved the issue. This time, unfortunately, it didn't. I then un-installed Adobe and tried again, UNSUCCESSFULLY. So I loaded Foxit Reader, also without any success.
    If there's anyone out there who could possibly help, please do so... It's extremely urgent.
    Please find the errors attached as well.
    Regards,
    ME

    I contacted the company and they asked me to try using another browser, which I did... and using FireFox worked
    thanks for the help ʇɐb ɹəuəllıʍ
    cheers!

  • Cannot open PDF - "file is damaged and could not be repaired"

    We created a signable, saveable, Reader Extended PDF in Acrobat X 10.1.4, with a Submit button that exports it using the "PDF The complete document" format to a .php page on our website using the url: http://www.todayscihld.us/pdfscript/fdf.php?form_name=WebForm 
    This is the .php page that's supposed to receive the export via the submit button and email it as an attachment:
    <?php
    // $form_name is provided in the url that calls this page, allowing this page
    // to be called from different PDF's, yet customized for each one
    $date = (date ("m/d/y"));
    $time = (date ("H:i:s T"));
    $tmpname = (date ("mdy-His"));
    $message = '
    This is a multi-part message in MIME format.
    ------=_NextPart_000_0007_01C37EC6.3F062EA0
    Content-Type: text/plain;
        charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit
    A '.$form_name.' was submitted from the Website at '.$time.' on '.$date.'.
    (attachment: '.$form_name.')
    ------=_NextPart_000_0007_01C37EC6.3F062EA0
    Content-Type: application/vnd.fdf;
        name="PDF-'.$tmpname.'.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
        filename="PDF-'.$tmpname.'.pdf"
    '.base64_encode(file_get_contents('php://input')).'
    ------=_NextPart_000_0007_01C37EC6.3F062EA0--
    $recip = "[email protected]";
    $subject = $form_name;
    $headers = "From: Website <[email protected]>\n";
    $headers .= "Return-Path: <[email protected]>\n";
    //use the following line for bcc:
    //$headers .= "bcc: [email][email protected][/email]\n";
    $headers .= "Content-Type: multipart/mixed; boundary=\"----=_NextPart_000_0007_01C37EC6.3F062EA0\"\n";
    $status = mail($recip, $subject, $message, $headers);
    Header("Location: http://www.todayschild.us/page.php?3");
    ?>
    Most of the time this works, however some of the time we get blank PDF files (<10KB), and sometimes we get filled PDF files that we cannot open in Adobe Reader X 10.1.4 - we get the "file is damaged and could not be repaired" error.  However, I can view this "damaged" pdf just fine in the Chrome built-in PDF viewer, and I can open it using Foxit Reader and Nitro Reader.  And if I open it in one of those programs and then save it under a new name, I can open the newly saved file in Adobe Reader.  So why is it that everything except Adobe Reader can open this file?
    Here's one of these problem PDF files: https://dl.dropbox.com/u/65535781/PDF-112612-162749.pdf
    Can anyone help me figure out what's going wrong, and what we can do to fix it? 

    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.

  • Trouble opening pdf's - I have received several pdf's from a friend via e-mail (Thunderbird). Some of them open just fine but others give me the message: "There was an error opening this document. The file is damaged and could not be repaired."

    Trouble opening pdf's - I have received several pdf's from a friend via e-mail (Thunderbird). Some of them open just fine but others give me the message: "There was an error opening this document. The file is damaged and could not be repaired." My friend made sure that the files in question opened without issue on his computer (a PC). Further, I was able to open one of these "damaged" files on my Android phone, but I cannot open them on the Macbook Air. Any help would be greatly appreciated.

    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.

  • SSRS PDF Export. There was an error opening this document. This file is damaged and could not be repaired

    Hello,
    I just experienced this problem, and was able to successfully mitigate.  I wanted to share my experience and Solution. 
    The problem started with the following error after succesfully exporting a PDF Document.  "There was an error opening this document. This file is damaged and could not be repaired."
    This is only applicable if you can still export and open SSRS Reports to other formats. Go to the Log files of the SQL Instance. In my particular case I used the Default MSSQL instance:   C:\ Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting
    Services\LogFiles  
    The Folder will begin with MSRS (SRS is for SQL Reporting Services)
    Sort the files by date modified and check for the most recent log file: ex.  SQLDmpr0000.log  The 0000 will be the incremental amount of errors you have experienced in SRS. Check for the following error:
    "System.DllNotFoundException: Unable to load DLL 'T2Embed': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
    Below is a sample from the log. 
    reportrendering!ReportServer_0-1!1b78!02/07/2012-11:56:03:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: , Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException:
    An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.DllNotFoundException: Unable to load DLL 'T2Embed': Access
    is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
       at Microsoft.ReportingServices.Rendering.ImageRenderer.FontPackage.TTGetEmbeddingType(Win32DCSafeHandle hdc, UInt32& status)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.FontPackage.CheckEmbeddingRights(Win32DCSafeHandle hdc)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFWriter.ProcessFontForFontEmbedding(PDFFont pdfFont, Dictionary`2 embeddedFonts)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFWriter.EndReport()
       at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream
    createAndRegisterStream)
       at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo,
    NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
       --- End of inner exception stack trace ---
       at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo,
    NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)
       at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderFromOdpSnapshot(IRenderingExtension newRenderer, String streamName, ProcessingContext
    pc, RenderingContext rc)
       --- End of inner exception stack trace ---;
    If you notice the error states that T2Embed.dll access is denied. In my case this due to a hotfix installed by Microsoft: 
     MS11-087: Vulnerability in Windows kernel-mode drivers could allow remote code execution: December 13, 2011
    Be advised, in order to fix your problem and render pdf's, a vulnerability shall be created.
     To fix this issue and allow the export to PDF work correctly, you must give the system Read/Execute Permissions, and Built-in\Administrators Full Control. 
    Go to Windows\System32 and find the T2Embed.dll Go to Security and modify the permissions as listed above. Do the same to the T2Embed.dll in the SysWow64 folder.
    Restart Reporting Services and you will be able to export to PDF. 
    Best Wishes! 
    Mariano
    www.lucontech.com 

    I'm not convinced this is the exact cause of the issue.  I will check my log files to see if I find anything like what you described.  However, I get this error when a particular user tries to do a "print preview" from a custom button.  The
    code builds a ReportViewer object, sets the ReportPath, etc.
    The reason I'm not convinced is because we have a separate reports page that has the report viewer embedded into it.  If the user generates the report that way and exports to PDF, Word, etc...the user can generate the file and be on their way.  As
    soon as the user clicks our "Print" button on the page without the ReportViewer embedded, the above mentioned error occurs.  
    UPDATE: Perhaps we have a different problem since my issue is from a custom button.  I found the solution
    here and confirmed the solution with the customer.  It had to do with the code using Response.Flush() instead of Response.End().
    One thing I noticed before I implemented the change: When you would close the PDF, it would ask you to save changes to the PDF.  After implementing Response.End() instead, that prompt went away.  No doubt it has to do with the differences between
    how Response.Flush() and Response.End() handle the stream returned.
    Anyway, posting in case someone has the same issue.

  • Keep getting the following error message There was an error opening this document. The file is damaged and could not be repaired.

    I keep getting the following message when trying to open a PDF I know nothing wrong with the file as it opens fine on other devices ?
    "There was an error opening this document. The file is damaged and could not be repaired."

    No its not zipped
    Brian Blackstock
    [email protected]
    Office Australia  +61 7 54537982
    Office South Africa +27 11 423 2701
    Mobile South Africa +27 796924094
    Mobile Australia +61 400797124
    www.atoll.co.za
    www.elematicsa.co.za

  • Pro 9 Users Receive "There was an error opening this document. The file is damaged and could not be repaired."

    Users with Adobe Acrobat 9 Pro (Windows XP) are not able to open PDFs created on the server. They receive the error message:
    “There was an error opening this document. The file is damaged and could not be repaired.”
    Even if the users save to disk and try to re-open, the error still occurs.
    This error did not surface in our QA testing because we were testing with Adobe Acrobat Reader 8. What can the difference be? Is there additional information that I can look for in order to troubleshoot this?
    Thank you for looking at my post. Please provide guidance in trying to resolve this issue.
    Elsa

    So, I'm not sure how much this will help but if you save the pdf AHW_Test_05112009xx.pdf and open it in a text editor, and go all the way down to the bottom where the %%EOF marker is, it looks as if the html page is getting appended to the end of the pdf. I recieved the "This file was damaged..." error in Adobe 7.1.0 when trying to open it but if you remove the html at the end, it opens up just fine.
    It appears that whatever's appending the html to the end is causing the issue.
    Below is what the file looks like near the end after the EOF:
    startxref
    400771
    %%EOF
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head><title>
        Gartner for IT Executives
    </title>

  • Acrobat 11 there was an error opening this document. the file is damaged and could not be repaired

    we are receiving an error when opening certain pdfs saying "there was an error opening this document. the file is damaged and could not be repaired"
    i've tried a few things to fix this issue with no luck
    tried on a brand new windows 7 install without any added software like anti-virus software, etc
    tried on my home pc (I forwarded the document from my work pc to my home pc and still receiving the same error)
    don't think it's anything related to the computers, thinking it's more an issue with the pdf. i've tried the basics like deleting temp files from IE, going to %temp% and deleting that out, doing an acrobat repair, trying in reader instead of acrobat, updating users from acrobat 10 to 11, and still receiving the same issue. the odd thing is, some people can open this document and some receive the error. the other thing is i've tried alternative pdf programs with no avail, same errors from those as well
    i work on the helpdesk with one other person  for the company and not sure what else we can try
    don't think this is a pc issue - tried on pcs in the company, home pcs, personal pcs and all get this error
    got to be an issue with either the pdf, or the way its being sent
    i did reach out to OUR e-mail team here (lotus notes admin) and they've ruled out anything as far as an encryption causing the conflict may go, so notes isn't the issue either
    would it be possible it's on the persons end that's sending the file?

    Unfortunately, CR 10.5 is not supported on WIN 2012 Server. See this wiki for more details. In order to work in a supported environment you will have to upgrade to CR 2008 Service pack 7, or SAP Crystal Reports, developer version for Microsoft Visual Studio (2010 / 2012 / 2013).
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Exporting PDF files from SSRS 2012 - "There was an error opening this document. The file is damaged and could not be repaired"

    Good day
    I have the situation where we are exporting PDF files from reporting services in our website. 
    When dividing the data into sections, the report exports perfectly, but when exporting the entire set and trying to open the file, we get the following error in Adobe Reader:
    "There was an error opening this document.  The file is damaged and could not be repaired"
    We tried to repair the file, no luck.  We tried to use different PDF readers, no luck
    We then checked the file sizes.  When exporting the subsections, each section exports a file of about 2mb. 
    When exporting the entire set, the file is about 1.3mb. 
    Adding all the sections together gives me a rough estimate of 40mb.
    Exporting to TIFF works beautifully and returns a file of 41.5mb. Word and Excel formats also work well, only issue there is the page numbering and formatting.
     The problem we have is the clients are adamant about having it in PDF format.
    Any advice please?

    This was one of the temporary suggestions I gave the client...
    Unfortunately they do not like this as the page numbering and formatting in Word does not appear right.  We are talking about over 1300 pages.  I can't expect them to change the formatting with each export.  Additionally,  the data is
    constantly changing and each client has their own data.  The clients export the reports randomly.  I therefore can't post the reports back onto the server.
    Thanks for the speedy response though

Maybe you are looking for