We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem in Copying header and footer with image from one document to another

Hi,

I am trying to copy 1 header and footer consisting of images and text from one document to another.

I am using following code:

private Document CopyHeadersFooters(Document srcDoc, Document dstDoc) throws Exception
{
for(HeaderFooter hf : srcDoc.getFirstSection().getHeadersFooters())
{
dstDoc.getFirstSection().getHeadersFooters().add(dstDoc.importNode(hf, true));
}
return dstDoc;
}

while doing so i getting the following error.

java.lang.IllegalStateException: Image file cannot be written to disk. When saving the document to a stream either ImagesFolder should be specified or custom streams should be provided via ImageSavingCallback. Please see documentation for details.


Hi,


Thanks for your inquiry. Could you please attach both of your input Word documents here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,