Logo not printing properly in Invoice converted to PDF and emailed

Hello,
I am having a problem with a programming issue and have searched lots of forums but have found no solutions.  We are on 4.7 and are not likely to upgrade any time soon.  Therefore, I don't think any of the newer solutions are gonna work for me.  I believe that I'm stuck using a couple of function modules to get t he job done.  I am attempting to modify our Invoice Print program (uses SAPscript, not SmartForms) to have the output converted into a PDF file and then attached to an email that is then sent to the customer.  Everything is working fine except for the company logo.  It has been uploaded via SE78.  It is a 24-bit bitmap file.  I have played around with the DPI to have it appear correctly on the form.  I added a FM GUI_DOWNLOAD step to verify that it is saved to my hard drive correctly.  The PDF file saved t o my hard drive appears normally in Adobe Acrobat and Adobe Reader.  So the problem occurs sometime after that.  I have a routine wherein I convert is from 132 to 255 bytes.  I then use FM SO_DOCUMENT_SEND_API1 to send it.  When I swap the customer's email address to my own personal external emal address, the resultant email has an attached PDF file but the company logo is garbage. The top portion of the logo looks good and then at some point in the lower portion is appears as squiggly lines.  This is not acceptable, of course.  I have included the relevent code below:
DATA: ITAB_OTFDATA   TYPE TABLE OF ITCOO WITH HEADER LINE.
DATA: ITAB_PDFDATA   TYPE TABLE OF TLINE WITH HEADER LINE.
DATA: ITAB_DOCTAB_ARCHIVE TYPE STANDARD TABLE OF DOCS.
DATA: ITAB_OBJPACK   LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE.
DATA: ITAB_RECORD    LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE.
DATA: ITAB_OBJTXT    LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE.
DATA: ITAB_OBJBIN    LIKE SOLISTI1   OCCURS 0 WITH HEADER LINE.
DATA: ITAB_RECLIST   LIKE SOMLRECI1  OCCURS 0 WITH HEADER LINE.
DATA: BINFILESIZE    TYPE I,
      G_LINES_TXT    TYPE I,
      G_LINES_BIN    TYPE I,
      DOCDATA        TYPE SODOCCHGI1,
      WA_RESULT      TYPE ITCPP,
      WA_BUFFER      TYPE STRING,
      WA_OBJHEAD     TYPE SOLI_TAB,
      G_INVOICE(10)  TYPE C.
CLEAR: BINFILESIZE.
  CALL FUNCTION 'CONVERT_OTF_2_PDF'
    EXPORTING
      USE_OTF_MC_CMD               = 'X'
*     ARCHIVE_INDEX                =
    IMPORTING
      BIN_FILESIZE                 = BINFILESIZE
    TABLES
      OTF                          = ITAB_OTFDATA
      DOCTAB_ARCHIVE               = ITAB_DOCTAB_ARCHIVE
      LINES                        = ITAB_PDFDATA
    EXCEPTIONS
      ERR_CONV_NOT_POSSIBLE        = 1
      ERR_OTF_MC_NOENDMARKER       = 2
      OTHERS                       = 3
  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
      filename                        = 'C:\TEMP\TEST.PDF'
      FILETYPE                        = 'BIN'
    tables
      data_tab                        = ITAB_PDFDATA.
  IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
*-- Convert PDF from 132 to 255
  LOOP AT ITAB_PDFDATA.
*   Replacing space by ~
    TRANSLATE ITAB_PDFDATA USING ' ~'.
    CONCATENATE WA_BUFFER ITAB_PDFDATA INTO WA_BUFFER.
  ENDLOOP.
* Replacing ~ by space
  TRANSLATE WA_BUFFER USING '~ '.
  DO.
    ITAB_RECORD = WA_BUFFER.
*   Appending 155 characters as a record
    APPEND ITAB_RECORD.
    SHIFT WA_BUFFER LEFT BY 255 PLACES.
    IF WA_BUFFER IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
  REFRESH: ITAB_RECLIST,
           ITAB_OBJTXT,
           ITAB_OBJBIN,
           ITAB_OBJPACK.
  CLEAR: WA_OBJHEAD.
  ITAB_OBJBIN[] = ITAB_RECORD[].
  G_INVOICE = VBRK-VBELN.
  SHIFT G_INVOICE LEFT DELETING LEADING '0'.
*-- Create Message Body Title and Document
  CLEAR: ITAB_OBJTXT-LINE.
  CONCATENATE 'Invoice'
             G_INVOICE
              'for Purchase Order'
              PO_NUM
              'is attached to this email.'
      INTO ITAB_OBJTXT-LINE SEPARATED BY SPACE.
  APPEND ITAB_OBJTXT.
  CLEAR: ITAB_OBJTXT-LINE.
  APPEND ITAB_OBJTXT.
  CLEAR: ITAB_OBJTXT-LINE.
  CONCATENATE 'Please see attached invoice.'
              'Thank you for your business!'
      INTO ITAB_OBJTXT-LINE SEPARATED BY SPACE.
  APPEND ITAB_OBJTXT.
  DESCRIBE TABLE ITAB_OBJTXT LINES G_LINES_TXT.
  READ TABLE ITAB_OBJTXT INDEX G_LINES_TXT.
  CONCATENATE 'Invoice' G_INVOICE
      INTO DOCDATA-OBJ_NAME SEPARATED BY SPACE.
  DOCDATA-EXPIRY_DAT = SY-DATUM + 10.
  CONCATENATE 'Invoice for P.O.'
               PO_NUM
               VBDKR-NAME1_WE
      INTO DOCDATA-OBJ_DESCR SEPARATED BY SPACE.
  DOCDATA-SENSITIVTY = 'F'.
  DOCDATA-DOC_SIZE = ( G_LINES_TXT - 1 ) * 255 + STRLEN( ITAB_OBJTXT ).
*-- Main Text
  CLEAR: ITAB_OBJPACK-TRANSF_BIN.
  ITAB_OBJPACK-HEAD_START = 1.
  ITAB_OBJPACK-HEAD_NUM = 0.
  ITAB_OBJPACK-BODY_START = 1.
  ITAB_OBJPACK-BODY_NUM = G_LINES_TXT.
  ITAB_OBJPACK-DOC_TYPE = 'RAW'.
  APPEND ITAB_OBJPACK.
*-- Attachment (pdf-Attachment)
  ITAB_OBJPACK-TRANSF_BIN = 'X'.
  ITAB_OBJPACK-HEAD_START = 1.
  ITAB_OBJPACK-HEAD_NUM = 0.
  ITAB_OBJPACK-BODY_START = 1.
  DESCRIBE TABLE ITAB_OBJBIN LINES G_LINES_BIN.
  READ TABLE ITAB_OBJBIN INDEX G_LINES_BIN.
  ITAB_OBJPACK-DOC_SIZE = ( G_LINES_BIN - 1 ) * 255 + STRLEN( ITAB_OBJBIN ).
  ITAB_OBJPACK-BODY_NUM = G_LINES_BIN.
  ITAB_OBJPACK-DOC_TYPE = 'PDF'.
  CONCATENATE 'Invoice' G_INVOICE
      INTO ITAB_OBJPACK-OBJ_NAME SEPARATED BY SPACE.
  CONCATENATE G_INVOICE '.pdf'
      INTO ITAB_OBJPACK-OBJ_DESCR.
  APPEND ITAB_OBJPACK.
*-- Create Table of email recipients
  CLEAR ITAB_RECLIST.
  ITAB_RECLIST-RECEIVER = KNB1-INTAD.
  ITAB_RECLIST-REC_TYPE = 'U'.
  ITAB_RECLIST-COM_TYPE = 'INT'.
  APPEND ITAB_RECLIST.
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
    EXPORTING
      DOCUMENT_DATA                    = DOCDATA
      PUT_IN_OUTBOX                    = ' '
      SENDER_ADDRESS                   = 'arcredit @ companyname.com'  <-- modified to comply with forum rules
      SENDER_ADDRESS_TYPE              = 'SMTP'
      COMMIT_WORK                      = 'X'
*   IMPORTING
*     SENT_TO_ALL                      =
*     NEW_OBJECT_ID                    =
*     SENDER_ID                        =
    TABLES
      PACKING_LIST                     = ITAB_OBJPACK
      OBJECT_HEADER                    = WA_OBJHEAD
      CONTENTS_BIN                     = ITAB_OBJBIN
      CONTENTS_TXT                     = ITAB_OBJTXT
*     CONTENTS_HEX                     =
*     OBJECT_PARA                      =
*     OBJECT_PARB                      =
      RECEIVERS                        = ITAB_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.
  ENDIF.
*-- Send the email immediately
  WAIT UP TO 3 SECONDS.
  SUBMIT RSCONN01 WITH MODE = 'INT'
                  WITH OUTPUT = 'X'
                  AND RETURN.
Thanks in advance for any and all advice.
Best Regards,
Nik von Ruden
Edited by: Nik Von Ruden on Nov 3, 2009 6:48 PM
Edited by: Nik Von Ruden on Nov 3, 2009 6:49 PM

Hi Friend ,
I hav gone through your code ...  I have one Question why you are  changing from 132 to 255.inside your program
if there is a purpose then , please can you change your company logo Image size accordingly  and uploaded it into SAP mime repository using se78.then your program let it convert from 132 to 255. definely you will see some change's in the Logo,then keep on adjusting you can acheive you result.
sometime the Image size also plays major role ,which we need to modify the sizes of image.
I am giving you an link which is already there  but still from myside  , just compare the code  .
Link: [http://www.scribd.com/doc/454814/SAPSCRIPT-to-PDF]
Regards,

Similar Messages

  • Convert to PDF and Email crashes

    Hi,
    Encountered this problem when I right click on a word file and select "Convert to PDF and Email". It will always crashes with the error "Adobe Elements had stopped working" and the message indicating something to do with ADIST.DLL.
    Had tried the followings but still the error persists.
    1. Uninstall/reinstall Acrobat Pro XI. Had deleted anything related to "Adobe" including Flash player and still no avail.
    2. Update the version to 11.0.07 and still the error is there.
    3. Only happens when converting Word 2010 documents. Excel, Outlook and others are fine.
    4. Valid licensed product from Adobe
    5. Tried renaming the "Adobe Elements" folder and does not work at all.
    6. Tried registering ADIST.DLL but encountered error.
    I am running on a Win 7 Pro 64 bit PC and due to this error, when i try using mail merge with a word doc, it also crashes. Anyone can assist on this? Many thanks in advance!
    Tan

    Crashes with distiller are pretty rare. Fonts can cause distiller to crash. A bad graphic in a file can cause distiller to crash. Maybe a corrupt job options file. Create a simple text file (one page), no graphics. Use the Times New Roman font. Print to Adobe PDF instance. Does the error still happen?

  • Not printing properly with horizontal lines

    HP Officejet Pro 8500A
    Not printing properly (Faded colors) with horizontal lines, printing excess pages with odd scripts.  I suspect printer heads.
    All color cartidges are full.  
    Printing can be direct from computer or by scanning from the printer.  Either way, it has the same issues.

    Hello,
    Please click HERE to access the steps that should resolve the issue .
    Regards,
    Jabzi
    Give Kudos to say "thanks" by clicking on the "thumps Up icon" .
    Click "Accept as Solution" if it solved your problem, so others can find it.
    Although I am an HP employee, I am speaking for myself and not for HP.

  • Windows 7 in OS printer driver for Deskjet 6840 not printing properly

    The Windows 7 (32 bit) in OS print driver for the Deskjet 6840 produces print in "Normal" mode that is blurred (not properly registered left to right and slightly vertically). When printing in "Draft" mode it is apparent that the driver is not setting the left and right margins correctly, so that each line is alternately shifted left or right on the page. If I switch to a 500C driver, the printer works fine (but of course high res images do not print properly). This is occuring on two wired network computers, both running clean installs of Windows 7 professional with all current updates including Service Pack 1. Microsoft says, "It's a HP printer, it's their problem". I'm just looking for an answer. Anyone have experience with this?

    Hello Bhl3302,
    Thanks for posting at NI forums! I think you should follow RavensFan advice on contacting the vendor for information on the driver’s support, or if you have a readme file, you could check on that. Also, are the Windows XP and Windows sharing the same architecture (32 or 64 bits)? Maybe the driver is not compatible with one of them, in case it changed. I did a quick search on the error message you're getting, and I found this forum in which they give some steps you could follow regarding the INF file. For instance, in one of the comments, they say they had a similar issue with another device and they found some work arounds. 
    Best Regards,
    Alina M

  • Bill of Lading (BOL) was not printing properly

    Hi ,
         In Production system, Bill of Lading (BOL) was not printing properly.
    Only a part of BOL is printed.
    It was happening only for one BOL, where as other BOLs are printing correctly.
    Even spool was generated successfully.
    Cananybodytellmewhatistheproblem?
    Regards,
    Koti

    Hi Kotireddy,
    I also face the same problem long back. The problem was at the delivery item text.
    One of the line item texts contained a special character.
    Once the special character was removed, everything was normal. BOL was printed successfully.
    Check the failed BOL, whether this may be the problem.
    Regards,
    SB.

  • 4.0 Beta 12 Will not print properly. Is there a fix? How do I uninstall Beta 12?

    After installing the latest patch NOTHING will print as it should. Every site, every file, everything is not spacing properly when sent to the printer. Previous version worked fine and all other browsers print properly.

    I downloaded the suggested file and it fixed the problem. Thanks.

  • USB P1505 not printing properly via Terminal Services

    I have problem printing to these printers via terminal services.  Other pinters print fine but these guys either print intermittently or not at all.  I have installed the latest drivers on the TS and the clients.  Sometimes sessions will be created and jobs would just remain in the queue or take a very long time to print.  They are the USB and not the N models.
    Any ideas?
    Win2k3 server
    Win2k Pro/WinXP clients

    The router is Zylex, the printer is an hp deskjet 3512. I first used the disk that came with the printer that did not work, so I uninstalled and downloaded off of this site thinking maybe it would be a more updated version. That did not work either. I have done all of the other troubleshooting that I have found on this site through other forums I unplugged the router, checked countless times to make sure the password and network were correct.
    My main issue at this point in time is that it will not print properly at all. I dont know if I need to download something to make it work. I am a full time student, work full time, and have children. I need my printer to work when I hook it up to usb, I dont have time to for all of these problems that I have had with this printer. I am actually in need of something printed at this very moment and my library is closed which is where I have had to go and pay .25 a page to print anything. So Please help!!!! 

  • My 5520 black is not printing properly

    My 5520 black is not printing properly> The diagnostic page black ink area is showing seven 5 mm bars. I tried multiple cleaning but no dice. Tried changing to another fresh black XL cartridge but no luck. Any advice?

    Hi @444blightd444,
    Welcome to the HP Forums!
    I see that your black ink is not printing properly with your HP Photosmart 5520. I am happy to help you with this printing issue!
    I would recommend to go through this print quality guide, Fixing Print Quality Problems for the HP Photosmart 5520 e-All-in-One and HP Deskjet Ink Advantage 5....
    Hope this helps, and have a good day!  
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • Jewel case insert does not print properly since new itunes version was installed

    jewel case insert does not print properly since new itunes version was installed. The song list prints all of the line items too close together without space inbetween each song.

    I am having the same issue. If I close itunes and open with a new CD already in the drive, it will find it. But once that CD has been imported and ejected, itunes does not find the newly inserted CD and there is no command to tell itunes to "look" in the CD drive

  • HT4623 The APP application on my iPad does not function properly - any downloads requested immediately fail and send me back to the main iPad screen.  Any suggestions on how to fix this - all software has been updated to iOS 5.1.1 and no other updates are

    The APP application on my iPad does not function properly - any downloads requested immediately fail and send me back tot he main iPad screen.  Any suggestions on to hoe to fix this?  The software has been updated to iOS 5.1.1, and no furthe updates are available.

    This is my boilerplate response when app downloads are stalled or in the "waiting" mode. There are a bunch of things here to try.
    Tap on the "installing" icon and see if you can pause the install, then tap on it again in order to resume the install.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Make sure that you do not have a stalled download in iTunes - a song or podcast .... if you have a download in there that did not finish, complete that one first. Only one thing can download and install at a time on the iPad so that could be what is causing the problem.
    If that doesn't work - sign out of your account, restart the iPad and then sign in again.
    Settings>iTunes & App Store>Apple ID. Tap your ID and sign out. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Go back to Settings>iTunes & App Store>Sign in and see if the install resumes.
    If all else fails, download the updates or the apps in iTunes on your computer and then sync the content to your iPad.

  • I just installed the free trial Adobe Acrobat XI Pro and it is not allowing me to freely convert a pdf to a word document????!!!!

    I just installed the free trial Adobe Acrobat XI Pro and it is not allowing me to freely convert a pdf to a word document????!!!! Why is this? Does anyone have this problem?

    When you report a problem you should always try to include as much relevant information as possible. Saying "it doesn't work, help me!" is not very helpful to us, because there could be a million reasons for it not working... What exactly happens when you try to convert a PDF to Word? Are there any error messages? How exactly are you trying to do it? Also, what operating system do you use? What version of Word? What exactly version of Acrobat? etc.

  • Hp 200 wireless printer does not print the shared attachment only body of the email

    In the past I have been able to share an email with the printer and the attachment was printed. Suddenly only the body of the email prints but no attachment. Would also like to know whether one can suppress the printing of the body of the email and print only the attachment. Don't want to waste paper.

    Thanks for that additional information @Karl3.  
    I have a few suggestions that may resolve your ePrint issue.  It is possible to print attachments using the ePrint via email method, but results may vary.  At times, the formatting of an attachment is lost when using this method or at worst, it will not print.  
    As it's clear your PDF document is not printing using this approach, I recommend downloading and installing the HP ePrint app - click here to do so.  
    You'll see that it's geared towards Android users, however, if your Blackberry Z10's software is up-to-date, this app should work for you.  Once installed, you'll be able to launch the ePrint app and print directly from files and documents saved to your device.  With this interface you have greater control over what comes out of the printer.  
    With respect to your query about eliminating the extra pages that result from your phone's email signature, click here for instructions on how to turn off your email signature.  If you swipe Auto Signature off as indicated in Blackberry's forum, this should ideally stop the undesired signature page from accompanying all ePrint attachment jobs.  If the ePrint app doesn't work out for you, see if printing with the signature off yields a better result.  Keep in mind when you're sending ePrint jobs to your printer via email that you need to have something in the subject line.  
    Please let me know the result of your troubleshooting by responding to this post.  Best of luck!  
    E-roq
    I work on behalf of HP.
    Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
    Click Kudos Thumbs Up on the right to say “Thanks” for helping!

  • HT3964 Hello, my isight camer is not working properly, i was using photo booth and suddenly the image was black or too dark and also ichat and facetime are too dark as well, please helpme out i can not find any solution.

    Hello, my isight camer is not working properly, i was using photo booth and suddenly the image was black or too dark and also ichat and facetime are too dark as well, please helpme out i can not find any solution.

    read this and see if it helps: http://support.apple.com/kb/ht2090

  • My printer will not print in black ,i replaced the ink and now it will not print in black ink

    my printer will not print in black ,i replaced the ink and now it will not print in black ink

    Please read this post then provide some details.  What printer model? What operating system? Are there any error messages on the printer or computer screen?
    Is your printer still in warranty? You can check with HP's warranty tool here.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • I installed Adobe CS6 Design & Web Premium on my Mac Book Pro a few years ago but have repeatedly encountered problems with the programs freezing or not opening properly. It's a Student and Teacher Licensing version so an academic ID is required but I am

    I installed Adobe CS6 Design & Web Premium on my Mac Book Pro a few years ago but have repeatedly encountered problems with the programs freezing or not opening properly. It's a Student and Teacher Licensing version so an academic ID is required but I am no longer a student--can I still reinstall it since my academic ID may no longer be valid?

    Erin Elzo as long as the serial number has been registered under your account at http://www.adobe.com/ then you should be able to continue to utilize the software.  You can find details on how to locate your registered serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

Maybe you are looking for

  • Asset value date in Internal order settlement ko88

    Hi. I have posted some expenses to the internal order. I m trying to settle it to AUC with tcode KO88. In the selection screen of ko88 i gave asset value date as 15.07.2011 but system is posting with month end date only as 31.07.2011. I read the sap

  • Search by revision number

    Hi All, I need to search on the basis of revision number that is assigned for each document that is checked in the content server.By default we can see Author,Content ID,Title,Type,Security Group and Account fields in Metadadata Search. How to add Re

  • Canon mf8580 was working with my iMac and not all print jobs say.....print job was not accepted

    can u help

  • Service Implementation methods in SEGW Transaction

    Hi Experts, I have created a project using SAP NetWeaver Gateway Service. In service implementation node, there is five methods. In this section, I have faced problems and have confusion. I am trying to explain my problems in below - 1. What are purp

  • Loading Acrobat Pro 8 on laptop

    I have had CS3 on my desktop for a long time but never got around to loading it on my laptop. I need to use it on there now and so have gone through the whole install of CS3 off original disks, twice. Each time it will not install Acrobat Professiona