//--------------------------------------------------------------------// // M e t h o d // // s t r e a m F i l e E m b e d // //--------------------------------------------------------------------// // // // Embed user-defined stream in output stream. // // // //--------------------------------------------------------------------// public static Boolean streamFileEmbed(BinaryWriter prnWriter, String filename, String streamName, Boolean encapsulated) { Boolean fileOpen = false; Boolean OK = true; Int64 fileSize = 0; fileOpen = streamFileOpen(filename, ref fileSize); if (!fileOpen) { OK = false; } else { const Int32 bufSize = 2048; Int32 readSize; Boolean endLoop; Byte[] buffer = new Byte[bufSize]; endLoop = false; if (!encapsulated) { PCLXLWriter.streamBegin(prnWriter, streamName); } while (!endLoop) { readSize = _binReader.Read(buffer, 0, bufSize); if (readSize == 0) { endLoop = true; } else { PCLXLWriter.writeStreamBlock(prnWriter, !encapsulated, buffer, ref readSize); } } if (!encapsulated) { PCLXLWriter.streamEnd(prnWriter); } streamFileClose(); } return(OK); }