AOP PL/SQL - API Documentation

aop_convert19_pkg

Created by Dimitri Gielis on 12/12/2015
Package to convert files with AOP.

Constants

Mime Types

c_mime_type_docx
c_mime_type_docx constant varchar2(100) := 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'

c_mime_type_xlsx
c_mime_type_xlsx constant varchar2(100) := 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

c_mime_type_pptx
c_mime_type_pptx constant varchar2(100) := 'application/vnd.openxmlformats-officedocument.presentationml.presentation'

c_mime_type_pdf
c_mime_type_pdf constant varchar2(100) := 'application/pdf'

c_mime_type_html
c_mime_type_html constant varchar2(100) := 'text/html'

c_mime_type_markdown
c_mime_type_markdown constant varchar2(100) := 'text/markdown'

c_mime_type_rtf
c_mime_type_rtf constant varchar2(100) := 'application/rtf'

c_mime_type_json
c_mime_type_json constant varchar2(100) := 'application/json'

c_mime_type_text
c_mime_type_text constant varchar2(100) := 'text/plain'

c_mime_type_zip
c_mime_type_zip constant varchar2(100) := 'application/zip'

Output

c_output_encoding_raw
c_output_encoding_raw constant varchar2(3) := 'raw'

c_output_encoding_base64
c_output_encoding_base64 constant varchar2(6) := 'base64'

Others

c_aop_version
c_aop_version constant varchar2(5) := '19.1'

c_aop_url
c_aop_url constant varchar2(50) := 'http://api.apexofficeprint.com/'

for https use https://api.apexofficeprint.com/

c_init_null
c_init_null constant varchar2(5) := 'null;'

c_source_type_sql
c_source_type_sql constant varchar2(3) := 'SQL'

Function CONVERT_FILES

Created by Dimitri Gielis on 9/1/2018
Convert one or more files by using a SQL query with following syntax (between [] can be one or more columns) select filename, mime_type, [file_blob, file_base64, url_call_from_db, url_call_from_aop, file_on_aop_server] from my_table

Syntax

function convert_files(
  p_query                 in clob,
  p_output_type           in varchar2,
  p_output_encoding       in varchar2 default c_output_encoding_raw,
  p_output_to             in varchar2 default null,
  p_output_filename       in out nocopy varchar2,  
  p_output_converter      in varchar2 default null,
  p_output_collection     in varchar2 default null,
  p_aop_remote_debug      in varchar2 default 'No',
  p_aop_url               in varchar2,
  p_api_key               in varchar2 default null,
  p_app_id                in number   default null,
  p_page_id               in number   default null,
  p_user_name             in varchar2 default null,
  p_init_code             in clob     default c_init_null,
  p_failover_aop_url      in varchar2 default null,
  p_failover_procedure    in varchar2 default null,
  p_log_procedure         in varchar2 default null)
return blob

Parameters

  • p_query Format of query: select filename, mime_type, file_blob, file_base64, url_call_from_db, url_call_from_aop, file_on_aop_server from my_table
  • p_output_type Extension (pdf, xlsx, ...) or mime type (application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, ...) of the output format. Following constants exists in aop_api_pkg: - c_word_docx - c_excel_xlsx - c_powerpoint_pptx - c_pdf_pdf - c_html_html - c_markdown_md - c_text_txt - c_word_rtf - c_onepagepdf_pdf - c_count_tags - c_defined_by_apex_item
  • p_output_encoding Following constants can be used: c_output_encoding_raw, c_output_encoding_base64
  • p_output_to Where does the blob or file need to be sent to: - c_output_browser: the browser will open the file - c_output_procedure: a blob will be passed to a procedure which is defined in p_procedure - c_output_procedure_browser: a blob will be passed to a procedure which is defined in p_procedure and the file is sent to the browser - c_output_inline: the output is defined for showing inline in a region - c_output_directory: the file is stored on the AOP Server in this directory - c_output_cloud: a file is sent to the cloud (Dropbox, Amazon S3, Google Drive) using the credentials defined in g_cloud_provider, g_cloud_location and g_cloud_access_token
  • p_output_filename Filename of the result
  • p_output_converter Define the PDF converter you want to use. Multipled converters can be defined in the AOP Server.
  • p_output_collection If a zip file is returned the files will be unzipped and put into a collection, currently not implemented, future improvement
  • p_aop_remote_debug Turning debugging on will generate the JSON that is sent to the AOP Server in a file. The actual request to the AOP Server is not done. Following constants can be used: - c_debug_remote: store the JSON in your dashboard on https://www.apexofficeprint.com - c_debug_local: store the JSON local on your pc - c_debug_application_item: depending the Application item AOP_DEBUG, Remote (Yes) or Local (Local) or no debugging is done
  • p_aop_url Description: URL where the AOP Server is running. For the AOP Cloud use c_aop_url
  • p_api_key Description: API Key which can be found when you login at https://www.apexofficeprint.com
  • p_app_id APEX Application ID
  • p_page_id Page ID to call in the APEX application
  • p_user_name Username which should be used to create an APEX session
  • p_init_code Initialisation code which can be invoked in this package

  • Return

  • Converted file in blob

Example

  select filename, mime_type, file_blob, url_call_from_aop
    from my_table