Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: XML and PDF...

Re: XML and PDF...

From: Verner Jensen, Ålborg <java_at_ofir.dk>
Date: Sat, 26 Mar 2005 12:31:38 -0800
Message-ID: <CLb1e.107527$Vf.4081513@news000.worldonline.dk>


Thx alot - fine description ;-)

Rgds, Henrik

"Romin Irani" <romin.k.irani_at_gmail.com> wrote in message news:95f6cc08.0503251930.11605019_at_posting.google.com...
> ptjm_at_interlog.com (Patrick TJ McPhee) wrote in message
> news:<3aj0npF67ube5U1_at_uni-berlin.de>...
>> In article <TQT0e.107429$Vf.4063527_at_news000.worldonline.dk>,
>> Verner Jensen, Ålborg <java_at_ofir.dk> wrote:
>>
>> % Is it possible to store a PDF doc, as part of an XML? Should the
>> PDF-part be
>> % encoded/wrapped or something, cause I can't figure out how the XML text
>> % format is able to hold binary data?
>>
>> It's typical to use MIME base-64 encoding to encode binary data in XML
>> files.
>
> Since the PDF file is a binary format -- you have to encode it in a
> fashion that is compatible with text while inserting it into the XML
> instance. As correctly mentioned here, you should be base64 encoding
> for the same.
>
> The process would roughly be the following:
> a) To encode the PDF
> 1) Take the PDF content as bytes
> 2) Run it through a program / method which goes something like:
> PDFInBase64Bytes = convertToBase64(PDFBytes)
> 3) Insert it into a XML instance after converting to string.
> <MyXMLDoc>
> <!-- other elements -->
> <PDFSegment>Base64 representation of
> PDF</PDFSegment>
> </MyXMLDoc>
> b) To decode the PDF
> 1) Extract out the value of the XML element <PDFSegment>.
> 2) Do the reverse i.e.
> PDFBytes = decodeFromBase64(<PDFSegment> value...)
> 3) Provide the PDFBytes to a PDF-aware application e.g. Adobe PDF
> Reader.
>
> There are several free base64 encoding/decoding libraries available on
> the net in a variety of languages. Pick up and try it out quickly.
>
> We have used the above process as mentioned and it works fine.
Received on Sat Mar 26 2005 - 14:31:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US