PDF sobre un campo imagen

Tengo un pdf y quiero coger el contenido de este y ponerlo en un campo imagen de forms, que en la tabla de base de datos este campo imagen es de tipo long raw, como podria hacerlo ?
Gracias

1 Respuesta

Respuesta
1
Bookmark Fixed font Go to End
Doc ID: Note:115729.1
Subject: How to Load Acrobat Files into a Table and Create a Context Index
Type: BULLETIN
Status: PUBLISHED
Content Type: TEXT/PLAIN
Creation Date: 23-JUL-2000
Last Revision Date: 21-MAR-2002
PURPOSE ------- The following article describes how to load Acrobat files into a table and create a Context index on that table. SCOPE & APPLICATION ------------------- This note is intended to be used as a guideline for creating Context indexes whose document format is binary. HOW TO LOAD ACROBAT FILES INTO A TABLE AND CREATE A CONTEXT INDEX ----------------------------------------------------------------- Note 1: This was tested against Oracle 8.1.5. Note 2: It is assumed the reader has set up Oracle Intermedia Text for Oracle 8.1.5, having the CTXSYS user, if it is not created yet, please refer to [NOTE:73605.1] Note 3: Here it is assumed that the platform for this testcase is a UNIX machine; therefore, all filenames and directory structures are coded using UNIX conventions,that is a slash ("/") as directory seperator, and case-sensitive filenames and directory names. Step 1. As SYSTEM create directory and grant read privilege to ctxdemo. $ sqlplus system/manager create or replace directory DIR_TESTCASE as '/u02/home/usupport/jbarba/testcase'; grant read on directory DIR_TESTCASE to ctxdemo; -- Substitute '\u02\home\usupport\jbarba\testcase' to your own directory where the -- Acrobat PDF files reside. -- It is the only activity as SYSTEM, the rest of the commands are executed by ctxdemo. -- You need to have the PDF files on your system in the specified directory, -- before continuing with the next step. Step 2. Workaround for [BUG:1050327] connect ctxdemo/ctxdemo create table workaround1 (id number primary key); insert into workaround1 values (1); commit; Step 3. Create table and insert row. create table pdffiles (id number(3) primary key, description varchar2(20), text blob default empty_blob()) / insert into pdffiles(id, description) values(1, 'InterMedia Concepts'); commit; -- Is it necessary to use empty_blob() as a default to avoid -- uninitialized blob error Step 4. Create a procedure to load the Acrobat file. CREATE OR REPLACE PROCEDURE loadpdf IS Dest_loc BLOB; Src_loc BFILE := BFILENAME('DIR_TESTCASE', 'InterMedia.pdf'); Amount INTEGER := 75788; BEGIN /* bug1050327 */ update workaround1 set id=1; SELECT text INTO Dest_loc FROM pdffiles WHERE id = 1 FOR UPDATE; /* Opening the LOB is mandatory: */ DBMS_LOB.OPEN(Src_loc, DBMS_LOB.LOB_READONLY); /* Opening the LOB is optional: */ DBMS_LOB.OPEN(Dest_loc, DBMS_LOB.LOB_READWRITE); DBMS_LOB.LOADFROMFILE(Dest_loc, Src_loc, Amount); /* Closing the LOB is mandatory if you have opened it: */ DBMS_LOB.CLOSE(Dest_loc); DBMS_LOB.CLOSE(Src_loc); COMMIT; END; / -- Substitute InterMedia.pdf with the name of your PDF file, and the Amount' value -- with the exact size of the file. Step 5. Load the Acrobat PDF file executing the new procedure execute loadpdf Step 6. Define preferences and attributes begin ctx_ddl.create_preference('pdf_lexer', 'BASIC_LEXER'); ctx_ddl.set_attribute('pdf_lexer', 'printjoins', '_-'); end; / Step 7. Create Context index create index PDFFILES_TEXT on PDFFILES(TEXT) indextype is ctxsys.context parameters ('lexer pdf_lexer') / Step 8. Execute queries against the new created index select id, description from pdffiles where contains(text,'intermedia') > 0 / RELATED DOCUMENTS ----------------- [NOTE:73605.1] Steps to install context manually, after installing server with intermedia option [NOTE:76523.1] interMedia Text FAQ KEYWORDS -------- ACROBAT PDF BINARY BLOB INSO_FILTER Intermedia Text DRG
.
Oracle Portal Technical Forum
Displayed below are the messages of the selected thread.
Thread Status: Active
From: Basilisco Giorgio 19-Feb-03 14:28
Subject: file_name of the file upload into the record blob
Portal Version: Release 2
RDBMS Versjion: 9i
OS/Vers. Where Portal is Installed:: windows 2000 server
Error Number(s)::
FILE_NAME OF THE FILE UPLOAD INTO THE RECORD BLOB
as I can directly pass in a field file_name the name of a file of a field
file_download type BLOB.
1 I have file_tabel table:
file_date BLOB
name varchar2
2 I have create the Form on the OraclePortal to insert the documents into the
DB and the item file_date is type FileBinary Upload
3 I have created a report to visualize the document with this procedure:
Create or Replace PROCEDURE file_download (p_file IN VARCHAR2) IS
Lob_field BLOB;
buffer RAW(32767);
offset BINARY_INTEGER:=1;
buffer_size NUMBER:=32767;
document_type varchar2(128);
BEGIN
SELECT file_date INTO Lob_field FROM file_table WHERE NAME = p_file;
htp.print('Content-type: application/force-download');
htp.print('Content-Disposition: attachement; filename=' || p_file);
htp.print('');
LOOP
DBMS_LOB.READ(lob_field,buffer_size,offset,buffer);
htp.prn(UTL_RAW.CAST_TO_VARCHAR2(buffer));
offset:=offset+buffer_size;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
null;
END;
and this sql query:
select 'HREF="'||owa_util.get_owa_service_path||'gix.file_download?p_file='||name||'">do
wnload' download, name FROM file_table
all correctly works,but there is a thing that should not go so, that is I want
the name of the file to automatically be inserted in the field name and not
that I have to manually insert it from the form of portal.
The my file are PDF.
Regards
----------------------------------------
Basilisco Giorgio
Servizi di Rete CDS
(Centro di servizi Didattico Scientifico)
Università degli Studi di Napoli Federico II
Via Cinthia - Complesso Universitario Monte S.Angelo - Ed. Centri Comuni
80126 napoli - italia
--------------------------------------------------------------------------------
From: Oracle, lakshmi reddeppa 20-Feb-03 09:52
Subject: re : file_name of the file upload into the record blob
Hi Basilisco,
¿Can you explain the following in detail?
"but there is a thing that should not go so, that is I want the name of the file to automatically be inserted in the field name and not that I have to manually insert it from the form of portal.
The my file are PDF."
¿In which table do you want to insert the file name? How are you inserting it manually from portal form?
Thanks and Regards,
Lakshmi Reddeppa.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas