Skip to main content
Question

Base64 encoded PDF gets corrupted when file size is large

  • May 6, 2026
  • 0 replies
  • 5 views

Forum|alt.badge.img+6

Hi, 

I’m working on an integration to automatically create and attach documents to invoices. My approach is to send the PDF as a Base64-encoded string wrapped in a CDATA section within an XML file. This works fine for smaller files, the document is created and attached correctly. However, with larger files, the document becomes corrupted and cannot be opened. Does anyone have an idea what might be causing this?

 

Code segment I used to write data

file_data_ := Plsqlap_Document_API.Get_Blob_Value(document_, 'FILE_DATA', element_);

 

Sample XML file

<INVOICE_STRUCTURE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns="urn:ifsworld-com:schemas:manual_supplier_invoice_creation_request">

    <MSG_ID>260325001</MSG_ID>

    <SUPPLIER_INVOICES>

        <INVOICE>

            <INVOICE_ID>NW087</INVOICE_ID>

            <FILE_NAME>CDN Controls Ltd - NW073 - 97650</FILE_NAME>

            <FILE_DATA><![CDATA[JVBERi0xLjcNCiWhs8XXDQoxIDAgb2J...]]></FILE_DATA>

      </INVOICE>

    </SUPPLIER_INVOICES>

</INVOICE_STRUCTURE>