Author Topic: How to concatenate data and resource file  (Read 1753 times)

Siva

  • Guest
How to concatenate data and resource file
« on: June 22, 2017, 05:34:38 AM »
Hi All,

I have a afp document retrieved via ODWEK (getDocument api) and separate resource file (using getResource api). When i view the afp document, it appears good in Windows but i could not find a logo in it.

        1. Whether the afp document automatically pick up the resources if it's available in the same path ? or do i need to configure the resource path somewhere ?
        2. Do i need to merge the afp file with resource file ? If, so please advise as to how to proceed.

« Last Edit: June 22, 2017, 05:37:22 AM by Siva »

JavierEstradaB

  • Guest
Re: How to concatenate data and resource file
« Reply #1 on: June 29, 2017, 08:22:54 AM »
Hi, how's it going?

  I recently came across the same issue, you have to explicitly request for both the resfile and the real document as separate bytes and then join them together. I found an example somewhere (I think it was the doc file on how to work with ODTransform xml files) and the author didn't explain that part of joining the resources and the doc, but here's it anyway...

Code: [Select]
//Obtain the resources and the document...
document = ODHIT_result.getDocument(); 
resources = ODHIT_result.getResources();
final_doc = new byte[document.length + resources.length];

//Copy both byte arrays... the resources have to come FIRST AT ALL TIMES!!!
System.arraycopy(resources,0,final_doc,0,resources.length);
System.arraycopy(document,0,final_doc,resources.length,document.length);

That's it, now the full document is located in byte[] final_doc

Hope that helps