Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8950

Convert PDF File to ASCII / Text File

$
0
0

Hello,

I have a PDF File that was created from a Spools (Output of Smart Form to begin with and run in background) using the SAP Function module - CONVERT_OTFSPOOLJOB_2_PDF and I have the pdf file archived.

 

Now, I need to do Reverse process. The original Spool is gone, and I need to extract some data from the pdf file - say, for example:

 

I need to extract A/c numbers where the Label is "Account No:" followed by value of the Account No.

 

I opened the pdf file in Binary mode, stored into an internal table of type Hex and then LOOP ed through this table.

 

Moved the Hex data to a long enough data field of Type C to use "CS" operator in an IF Statement to look for the String "4163636F756E74204E6F3A" which is Hex representation of  'Account No:' (without the single quotes).

 

I can see 'Account No:' in the PDF File but my IF Statement with CS fails. I even tried to find the Zip Code using CS Statement - it fails too.

 

Some sample codes that I used are as follows:

 

  LV_TAG_1_C = '4163636F756E74204E6F3A'.

  

refresh: T_DATA_FILE_C.

 

  LOOP AT T_DATA_FILE_X.

    ASSIGN T_DATA_FILE_C-DATA TO <FS_C>.

 

    T_DATA_FILE_C-DATA     = T_DATA_FILE_X-DATA.

 

    IF T_DATA_FILE_C-DATA CS LV_TAG_1_C.

* The Above IF Statement NEVER became TRUE - even though I can see the "Account No:"

 

      LV_VAL_1_C = <FS_C>+SY-FDPOS(6).

      APPEND T_DATA_FILE_C.

    ENDIF.

*

 

  ENDLOOP.

 

Outside LOOP, T_DATA_FILE_C is still EMPTY.

 

Please let me know if you know of any example where I can extract data in ASCII format from a PDF File.

 

Please NOTE - I do NOT need to convert a spool to PDF File (whole website is full of this) - I need the opposite !!!

 

Help will be much appreciated.

 

Regards,

Tarun (MAILTKB@YAHOO.COM)


Viewing all articles
Browse latest Browse all 8950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>