Breadcrumbs

Give it a try

Invalid configuration

The directory UC_PDF_REGION_PRO_DIR doesn't exist yet. Please read the explanation to setup the directory in order to access the file system.
If you have the privilege to create a directory you can enter the path on the filesystem here and click the button to setup the directory and external table.
The path /home/oracle/pdf is supported by the script defined in list_directory.sh. In order to use different path, please update the list_directory.sh contents. Learn more in the explanation below.

Intro

This PDF Region Pro implementation uses a custom PL/SQL package, UC_PDF_REGION_PRO_CUSTOM_PKG, to process and store the documents in the file system.
You can create a new file in the Demo tab or open an existing file by clicking on a file in the View Files tab.

Place the following in the Initialization PL/SQL Code:


    uc_pdf_region_pro.g_doc_getfileinfo := 'uc_pdf_region_pro_custom_pkg.uc_pdf_region_pro_filesystem_getfileinfo';
    uc_pdf_region_pro.g_doc_create      := 'uc_pdf_region_pro_custom_pkg.uc_pdf_region_pro_filesystem_create';
    uc_pdf_region_pro.g_doc_update      := 'uc_pdf_region_pro_custom_pkg.uc_pdf_region_pro_filesystem_update'; 
  

For this example to work, you need to create a DIRECTORY and an EXTERNAL TABLE.
The directory in the Oracle database gives you access to the file system.
The external table is used to read the files in the directory.

To set up the UC_PDF_REGION_PRO_DIR directory in the Oracle database, which points to the /home/oracle/pdf directory on the file system:


  create or replace directory UC_PDF_REGION_PRO_DIR as '/home/oracle/pdf';
  
If you get an ORA-01031: insufficient privileges error, run the following SQL (as SYS) to give the user privileges to create directories:

  grant create any directory to USER;
  
Add the following file and contents list_directory.sh to the /home/oracle/pdf directory:

  #!/bin/bash
  /usr/bin/ls -l --time-style=+"%Y-%m-%d:%H:%M:%S" "\$(/usr/bin/cat \$1)"
  EOF
  
Now create the UC_PDF_REGION_PRO_EXT_FILES external table:

  -- drop the table that exists 
  DROP TABLE uc_pdf_region_pro_ext_files;
  
  -- create the table
  CREATE TABLE uc_pdf_region_pro_ext_files (
   file_name        VARCHAR2(200),
   file_permissions VARCHAR2(11),
   file_hardlinks   NUMBER,
   file_owner       VARCHAR2(32),
   file_group       VARCHAR2(32),
   file_size        NUMBER,
   file_datetime    DATE
  )
  ORGANIZATION EXTERNAL (
   TYPE ORACLE_LOADER
   DEFAULT DIRECTORY UC_PDF_REGION_PRO_DIR
   ACCESS PARAMETERS (
     RECORDS DELIMITED BY NEWLINE
     NOBADFILE NOLOGFILE NODISCARDFILE
     PREPROCESSOR UC_PDF_REGION_PRO_DIR:'list_directory.sh'
     FIELDS TERMINATED BY WHITESPACE
     (
       file_permissions,
       file_hardlinks,
       file_owner,
       file_group,
       file_size,
       file_datetime DATE 'YYYY-MM-DD:HH24:MI:SS',
       file_name
     )
   )
   LOCATION (UC_PDF_REGION_PRO_DIR:'list_directory.sh')
  )
  REJECT LIMIT UNLIMITED;