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: dc <someone_at_nowhere.com>
Date: Wed, 30 Mar 2005 10:14:11 -0500
Message-ID: <8fWdnYC2G_0bX9ffRVn-vg@adelphia.com>


here's an example of an XML doc that contains a PNG image, base64-encoded. http://dinoch.dyndns.org:7070/WordML/source/WordML/10555.xml

here's the JSP that generates it:
http://dinoch.dyndns.org:7070/WordML/srcview.jsp?dir=WordML&file=GetOrderConfXsl.jsp

you can actually run the JSP and load that XML into MS Word and see the result of the image.
http://dinoch.dyndns.org:7070/WordML/GetOrderConfXsl.jsp (need MS-Word installed to do this)

-D

"Verner Jensen, Ålborg" <java_at_ofir.dk> wrote in message news:CLb1e.107527$Vf.4081513_at_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 Wed Mar 30 2005 - 09:14:11 CST

Original text of this message

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