Decoding pdf data which was encoded as a single string

I am storing a single (very large BLOB) string which is a base64 encoding of a .pdf file.
If I try to decode the string I get a corrupted .pdf file.
Below is the code I'm using to decode...
blob_len := dbms_lob.getlength(pdf_blob);
offset := 1;
amount := 78;
DBMS_LOB.CREATETEMPORARY(blob_dec,true);
loop
if offset >= blob_len then
exit;
end if;
dbms_lob.read(pdf_blob,amount,offset,dec_buffer);
dbms_lob.append(blob_dec,utl_encode.base64_decode(dec_buffer));
offset := offset + amount;
end loop;
NOTE: I know the inital .pdf is fine because if I take the same .pdf file and encode it via Oracle's utl_encode.base64_encode facility, I can decode the data without any issue.
I do notice that the utl_encode.base64_encode creates individual lines of 76 characters in length with CR's at the end of each, whereas the string I need to work with is a single long string of 201,433 characters.
The string is coming in from an external webservice so I cannot influence its format.
I can't read in the string in a single dbms_lob.read call as iIm restricted to the size of the buffer RAW definition (i.e. 32767 ).
Any help appreciated.
anthony.

ascheffer,
Thanks for your reply.
I set the offset to 78 because all examples on the net had this figure.
I've just changed the offset to 76 as per your suggestion, and I can't believe that this works.
You're a hero!!!
Thanks,
Anthony.

Similar Messages

  • I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I need my application to be able to open a .pdf file which was previously synced to the iBooks PFDs Collection. I then wish to remove the file from the collection and send it to email.

    I opened one of the PDF files in notepad and these are the first couple lines:
    瀖ᕁމጿ␠씴豈䧉筩롈ꓳ劏ꎯ僪뚢頟뻏즏谀㿃夑퀉꟠鲲쮂⫉笿褡밤籞冁탁ӓ轸뿐笼ⵆ횰䄌ඁ淥ة寨闤⬅鳦팥링빨嬄敎უ婏㣴ً鮓ࣿꢚ㑀녲莒඼ိȆ䕇纍쉉籶뺝갞伐쮠᥏﯒넉釖ȓ겴☧ ἣ秵駻�䣞띰㖔流羀籔朼敨ꢉ糶당⬤俉膇䄐惡�ಹꛖ鍡恡ⱶᶜ�堷﹑ﱌ僿걄뎔æ䋷귪⛢⫐䅪䉙὿烶ꖆ႟ᗔ瘞狻틫儩六잶覱낵듘盋崾�ᦜ㺆௹뻹燴ឋ騙쬄ꏿ뽒煹�钼뇲腎稦ꃲ㈃沒ꔈ뺐뛽첑䘶畱䍣紻 ⁜哠鳾

  • How to get the PDF data which i have send to Spool

    Dear Freinds,
                   My requirement is to display the output which iam getting from a custom report(ZSALARY) in the form of  PDF . So now i wanted to display the ALV output  on to my desktop (as of now) in PDF format.
    i have done the below coding please correct me why iam not getting the same data which is coming out of my report in the PDF, iam passing the same internal table.
    IF NOT it_final[] IS INITIAL.       -
    >IT_FINAL is my main internal table in the report ZSALARY
          DATA : count TYPE syprcop,
             days TYPE sypexpi,
             params TYPE pri_params,
             valid TYPE c,
          pdf_table TYPE  rcl_bag_tline,
          spoolid TYPE rspoid,
          pdf_fsize TYPE  i.
            CALL FUNCTION 'GET_PRINT_PARAMETERS'
              EXPORTING
                destination    = 'LP01'
                copies         = count
                list_name      = 'ZSALARY'   -
    tHIS IS MY REPORT NAME
                list_text      = 'ZSSPOOL'
                immediately    = ' '
                release        = 'X'
                new_list_id    = 'X'
                expiration     = days
                line_size      = 90
                line_count     = 65
                layout         = 'X_PAPER'
                sap_cover_page = 'X'
                receiver       = 'SAP*'
                department     = 'System'
                no_dialog      = 'X'
              IMPORTING
                out_parameters = params
                valid          = valid.
            NEW-PAGE PRINT ON PARAMETERS params NO DIALOG.
            WRITE : 'hi this is the test for spool'.
            NEW-PAGE PRINT OFF.
            COMMIT WORK.
            WRITE : / 'The Spool no is ', sy-spono. "system variable for spool no
            spoolid = sy-spono   .       -
    At this point i can see the spool no.
            CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
              EXPORTING
                src_spoolid   = spoolid
                no_dialog     = 'X'
              IMPORTING
                pdf_bytecount = pdf_fsize
              TABLES
                pdf           = pdf_table
              EXCEPTIONS
                OTHERS        = 0.
            CHECK sy-subrc = 0.
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                bin_filesize = pdf_fsize
                filename                = 'C:\Documents and Settings\Administrator\Desktop\test.pdf'
                filetype                = 'BIN'
              TABLES
                data_tab                = it_final
              EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                OTHERS                  = 5.
          ENDIF.
    if i go and on my desktop it is saying the below error "ADOBE  READER COUDNT OPEN 'test.pdf'
    because it is either not supported  file type or because the file has been damaged.
    my aim is to get the data which is there in IT_final in the PDF .....please correct me the parameters which i have given wrong. my doubt is in GUI_download  fM  in the tables should i pass it_final or
    the pdf_table coming from'CONVERT_ABAPSPOOLJOB_2_PDF'...... i tried this option iam able to open and it is just giving message which i kept before this FM i.e  WRITE : 'hi this is the test for spool'.
    what i should to get my internal table data.
    Pls help.
    regards
    srinivas.

    Dear Karthik,
              Thank you for giving me the link there by iam able to get the ouput download int he pdf
    as below code , but now a small problem for me .......i have 10 fileds in the Report ouput ....but however in the pdf output i can see only 8 fields and the two fields got truncated . Could you please tell me what
    i have to change in my below code so that i can get all the values  
    IF NOT it_final[] IS INITIAL.
    data : it_tsp01 type standard table of tsp01,
           l_wa_tsp01 type tsp01.
            CALL FUNCTION 'GET_PRINT_PARAMETERS'
              EXPORTING
                destination    = 'LP01'
                copies         = count
                list_name      = 'ZHR_BON'
                list_text      = 'ZSSPOOL'
                immediately    = ' '
                release        = 'X'
                new_list_id    = 'X'
                expiration     = days
                line_size      = 90
                line_count     = 65
                layout         = 'X_PAPER'
                sap_cover_page = 'X'
                receiver       = 'SAP*'
                department     = 'System'
                no_dialog      = 'X'
              IMPORTING
                out_parameters = params
                valid          = valid.
    SUBMIT (sy-repid) TO SAP-SPOOL
                     SPOOL PARAMETERS mstr_print_parms
                     WITHOUT SPOOL DYNPRO
                    WITH pnppernr =  p0001-pernr
                     AND RETURN.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
              EXPORTING
                src_spoolid   = spoolid
                 no_dialog     = 'X'
                 DST_DEVICE  = params-PDEST
               IMPORTING
               pdf_bytecount = pdf_fsize
              TABLES
                pdf           = pdf_table
              EXCEPTIONS
                OTHERS        = 0.
            CHECK sy-subrc = 0.
            CALL FUNCTION 'GUI_DOWNLOAD'
              EXPORTING
                bin_filesize            = pdf_fsize
                filename                = 'C:\Documents and Settings\Administrator\Desktop\test.pdf'
                filetype                = 'BIN'
              TABLES
                data_tab                = pdf_table    "it_final
              EXCEPTIONS
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                OTHERS                  = 5.
          ENDIF.
    Please tell me how i can get the all the fields which are there in my normal alv output ......
    Case 1) .i wanted all the 10 fields in PDF  to be displayed  without truncated , I have checked in Spool ........ i found all the fields are there .....but however when i check the downloaed PDF i can see some fields are getting truncated.
    Case 2) However  if on the ALV output if the user  hides 2 fields out of 10 fields then only 8 feilds which are appearing on the output  before sending the Spool should only be displayed in PDF as well -
    > for this scenario what i have to do.
    Thanks  Once again.
    regars
    srini.

  • My events photo albums have all been renamed with a number followed by IMPRT instead of the date which was how they were originally named. Also the photo now showing on the top of each folder is not actually in that folder. How do I restore?

    My events photo albums have all been renamed with a number followed by IMPRT (deleting the date on which they were taken) Also the photo now showing on the top of each folder is taken from a different event and so is not actually in the album it is sitting on top of. This happened when I linked to itunes. Any idea how to restore it to how it looked before?

    One thing that I find odd is that iTunes used to rebuild the .itl file when you deleted it.  It seems as if the newer iTunes somehow broke this old capability.  If you delete the .itl file it can't rebuild it- it simple treats this as if this is a fresh installation and completely ignores the fact that the .xml file has all the data in it.  I think Apple needs to bring back this old "feature".  Of course, the negative with that was that you lost all of the "Date Added" info along with some other stuff but at least it still kept the favorites info etc. (and I think maybe even the path although I don't believe I ever tried that because my account path has never changed until now).
    One side note: I can't find where the iTunes Windows SDK is.  I was hoping to try to use that to access the .itl "database" and write a utility to fix this situation.  Seems like this has moved from its original location...

  • Why can't I see my data which was entered and saved on a form when i try to reopen it? it always worked before until this spring 2014. The data is actually there when I click on a box but disappears when I go to the next box. I have a Mac.

    I am using a Mac and I have always filled out the same form (ocf-6 from ontario insurance companies, application for expenses)  It stopped letting me go back and open the previously saved forms which i filled out and I have saved monthly for the past 5 years. Now when I open a previously saved month /file I cannot see the data I inputed.  The data is there because when i highlight a box the data appears. then when i move onto the next field/box it disappears. I tried to highlight the whole document but nothing shows up. This problem started in the spring ,2014.

    Once you save that to a location on your system.
    Make sure Acrobat is Quit and then do this:
    1.  In the Finder go to the "Go" menu.
    2. Select Go to Folder
    3.  Paste this path into the "Go to the Folder:" field
    /Applications/Adobe Acrobat XI Pro/Adobe Acrobat Pro/Contents/Resources/JavaScripts/
    4. Copy the file into the JavaScripts folder.
    5. Launch Acrobat
    Now you should see the menu spoken of in the blog and web page.

  • Reading data which was wrote using fm BAL_LOG_MSG_ADD

    I have two queries:
    1) My z program is writing logs Using fn modules
    BAL_LOG_CREATE
    and
    BAL_LOG_MSG_ADD
    <b>Where can I view the log. Which tcode?</b>
    I have seen <b>SM21</b> but there is no entry for my transaction.
    2) What is the suitable way of writing log to SAP. My program is Posting goods movements with the help of fn module BAPI_GOODSMVT_CREATE.
    Code realted to point 1.
      PERFORM activate_message_header.
      PERFORM msg_add USING lw_bapireturn-type
                           lw_bapireturn-id
                           lw_bapireturn-number
                           lw_bapireturn-message_v1 lw_bapireturn-MESSAGE+0(15)
                           lw_bapireturn-message_v2 lw_bapireturn-MESSAGE+14(15)
                           lw_bapireturn-message_v3 lw_bapireturn-MESSAGE+29(15)
                           lw_bapireturn-message_v4 lw_bapireturn-MESSAGE+44(15).
    FORM activate_message_header .
      DATA: l_s_log    TYPE bal_s_log.
    * define some header data of this log
      l_s_log-aluser    = sy-uname.
      l_s_log-altcode   = sy-tcode.
    * create a log
      CALL FUNCTION 'BAL_LOG_CREATE'
        EXPORTING
          i_s_log                 = l_s_log
        IMPORTING
          e_log_handle            = w_handle_1
        EXCEPTIONS
          log_header_inconsistent = 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.
    ENDFORM.
    FORM msg_add  USING   p_msgty TYPE syst-msgty
                                p_msgid TYPE syst-msgid
                                p_msgno TYPE syst-msgno
                                p_msgv1 TYPE syst-msgv1 p_msgv1_SRC TYPE BALMSGVSRC
                                p_msgv2 TYPE syst-msgv2 p_msgv2_SRC TYPE BALMSGVSRC
                                p_msgv3 TYPE syst-msgv3 p_msgv3_SRC TYPE BALMSGVSRC
                                p_msgv4 TYPE syst-msgv4 p_msgv4_SRC TYPE BALMSGVSRC
      DATA: l_s_msg TYPE bal_s_msg.
    * define data of message for Application Log
      l_s_msg-msgty     = p_msgty.
      l_s_msg-msgid     = p_msgid.
      l_s_msg-msgno     = p_msgno.
      l_s_msg-msgv1     = p_msgv1. l_s_msg-MSGV1_SRC = p_msgv1_src.
      l_s_msg-msgv2     = p_msgv2. l_s_msg-MSGV2_SRC = p_msgv2_src.
      l_s_msg-msgv3     = p_msgv3. l_s_msg-MSGV3_SRC = p_msgv3_src.
      l_s_msg-msgv4     = p_msgv4. l_s_msg-MSGV4_SRC = p_msgv4_src.
    * add this message to log file
    * we do not specify I_LOG_HANDLE since we want to add this message
    * to the default log. If it does not exist we do not care
    * (EXCEPTIONS log_not_found = 0).
      CALL FUNCTION 'BAL_LOG_MSG_ADD'
        EXPORTING
          i_s_msg      = l_s_msg
          i_log_handle = w_handle_1
        EXCEPTIONS
            log_not_found = 0
            OTHERS        = 1.
    ENDFORM.

    Q 1. Where can I view the log. Which tcode?
    SLG1
    Q 2. (To best of my knowledge, which is very limited First we need to create a Z log object and subobject (transaction SLG0).  Save it using fn BAL_DB_SAVE

  • I've been importing all my old CDs into itunes but one of them which was unknown imported as single tracks. How can I combine these into one album

    I've been importing all my old CDs into itunes but one of them which came up as unknown has imported as single tracks named track 1, track 2 etc. It wasn't an obscure CD (Paul Carrack - the journey so far) but not one that's available in the itunes store. I've manually changed the track names but they all appear as single tracks in the "Albums" section. Is there a way to put them all into an album to show up as an album with the other albums. Other "unknown" CDs I imported have imported with the correct track names but just don't have the album artwork so I don't understand why this one is behaving totally different?

    If you select the tracks all together in iTunes/ Songs then go to File/Get info you will be asked "Are you sure you want to edit information for multiple items?" Go ahead and you can make them into an album, putting in the artist name, etc.

  • Download a file which is encoded as a String

    Hi All,
         I have a file which is encoded(Base64) as a String. Is there any way in flex to  decode and download the file.
      A sample code would help me !!!!!.
    Thanks.

    Check out the mx.utils.Base64Encoder/mx.utils.Base64Decoder classes.

  • Popularity trend/usage report is not working in sp2013. Data was not being processed to EVENT STORE folder which was present under the Analytics_GUID folder.

    Hi
     I am working in a sharepoint migration project. We have migrated one SharePoint project from moss2007 to sp2013. Issue is when we are clicking on Popularity trend > usage report,  it is throwing an error.
    Issue: The data was not being processed to EVENT STORE folder which was present under the
    Analytics_GUID folder. Also data was not present in the Analytical Store database.
    In log viewer I have found the bellow error.
    HIGH -
    SearchServiceApplicationProxy::GetAnalyticsEventTypeDefinitions--Error occured: System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly
    secured fault was received from the other party.
    UNEXPECTED - System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail,
    System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    HIGH - Getting Error Message for Exception System.Web.HttpUnhandledException
    (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party.
    CRITICAL - A failure was reported when trying to invoke a service application:
    EndpointFailure Process Name: w3wp Process ID: 13960 AppDomain Name: /LM/W3SVC/767692721/ROOT-1-130480636828071139 AppDomain ID: 2 Service Application Uri: urn:schemas-microsoft-
    UNEXPECTED - Could not retrieve analytics event definitions for
    https://XXX System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    UNEXPECTED - System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail,
    System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]: We're sorry, we weren't able to complete the operation, please try again in a few minutes.
    I have verified few things in server which are mentioned below
    Two timer jobs (Microsoft SharePoint Foundation Usage Data Processing, Microsoft SharePoint Foundation Usage Data Import) are running fine.
    APPFabric Caching service has been started.
    Analytics_GUID folder has been
    shared with
    WSS_ADMIN_WPG and WSS_WPG and Read/Write access was granted
    .usage files are getting created and also the temporary(.tmp) file has been created.
    uasage  logging database for uasage data being transported. The data is available.
    Please provide pointers on what needs to be done.

    Hi Nabhendu,
    According to your description, my understanding is that you could not use popularity trend after you migrated SharePoint 2007 to SharePoint 2013.
    In SharePoint 2013, the analytics functionality is a part of the search component. There is an article for troubleshooting SharePoint 2013 Web Analytics, please take a look at:
    Troubleshooting SharePoint 2013 Web Analytics
    http://blog.fpweb.net/troubleshooting-sharepoint-2013-web-analytics/#.U8NyA_kabp4
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How do I retrieve data from time machine from an old mac (which was running 10.5) on my new iMac running mavericks?

    How do I retrieve data from time machine from an old mac (which was running 10.5) on my new iMac running mavericks?

    See B 5/6.
    Time Machine Troubleshooting

  • I recently lost my MacBook pro which was synched with my apple tv.Now I'm having a problem to bring back my data from my apple tv to my new MacBook

    I recently lost my MacBook pro which was synched with my apple tv.Now I'm having a problem to bring back my data from my apple tv to my new MacBook

    Welcome to the Apple community.
    If you are referring to the first generation Apple TV, then you cannot sync content which is stored on its hard drive back to iTunes.

  • How do I open a Word file which was exported fron PDF?

    how do I open a Word file which was exported from a PDF file?

    Hi alansandy,
    You can find your converted Word file stored in your Acrobat.com account at https://cloud.acrobat.com. You can download your file from your account by selecting it and clicking the Download icon. Then, you can open it right up in Word!
    Best,
    Sara

  • Problems printing a converted PDF which was converted to Word after completing the form

    Problems printing a converted PDF which was converted to Word after completing the form.  I have spent the last 3 hours trying to figure out what I am doing incorrectly.  I can't get it to print in either the PDF or Word file.  Please help, I need to complete this form and sent it NJ Department of Motor Vehicles Commission.

    Hi, make sure you are using the latest release of PDF program.
    Please mark the post that solves your issue as "Accept as Solution".
    If my answer was helpful click the “Thumbs Up" on the left to say “Thanks”!
    I am not a HP employee.

  • HT1414 Hi All, i recently done a back up and update & restore, but ive lost my notes, my text messages and my reminders and notes on the calender, i also have lost the data i had in an app which was very important to me. Please Please help me,  i,m total

    Hi All, i recently done a back up and update & restore, but ive lost my notes, my text messages and my reminders and notes on the calender, i also have lost the data i had in an app which was very important to me. Please Please help me,  i,m total novice.
    I did this back up because i was instructed by my service provider. This was supposed to sort out my losing connection problem, which it didn't, it instead gave me a new problem. If there is anyone out there who can help me to retrieve my lost information i would appreciate it.
    Thank You in advance.

    You should be syncing your contacts with an app on your computer or cloud service (iCloud, Gmail, Yahoo, etc), and not relying on a backup.  If you haven't been doing this, start now and then restore your old backup.  You will then be able to sync the new contacts back into the phone.  However, you will lose all messages, etc newer thant the backup.

  • TS3999 how can I stop syncing my outlook calendar with icloud and not loose the existing calandar data in outlook?  the calendar data which downloads to outlook, was also wiped off the gmail calendar after the icloud sync , how can I restore the data to g

    How can I stop syncing my outlook calendar with iCloud and not lose the existing calendar data in outlook?  The calendar data which downloads to Outlook was also wiped off the Gmail calendar after the iCloud sync, how can I restore the data to Gmail?

    same issue, looks like nobody answered you from last JULY....

Maybe you are looking for

  • Memory error while running DI configuration wizard

    Hi We have installed NW 7.0 with DI usage. After Installation, we are running DI configuration Wizard. During step (at 48% ) Assign Role NWDI.XDeveloper to Group NWDI.XDevelopers its giving error: Exception Class:java.lang.OutOfMemoryError Following

  • Photoshop CS4 and Nikon .NEF files

    I just downloaded Photoshop CS4 for a trial basis. I use 2 nikon cameras and 1 Canon and shot is RAW format. The RAW file extensions are .NEF and .CS2. I had the understanding Photoshop had no problem reading these file formats (through ACR). However

  • How do u get movies on your ipod?

    how do u get movies on your ipod? i hav a 30 gb video ipod, so i can, but i cant figure out how. i've tried looking it up but it says nothing. pls help

  • WAG320N & E4200

    Hi guys, I have a WAG320N modem/router and an E4200 and I would like to create a LAN in my home. I installed the WAG320N on the 1st floor where I have my DSL cable and other devices (console, laptots, multimedia player). On the 2nd floor I installed

  • Can we synchronic  outlook's address book and calender to Mac's address boo

    hi, Can we synchronic outlook's address book to Mac's address book ? also outlook's calender to ical ? how ? thanks jigsb