Save document to the specified stream

Following code shows usage of save(OutputStream) method.

advanced_usage.saving_documents.SaveDocumentToTheSpecifiedStream

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();                                
                                                                                                 
// Specify an absolute or relative path to your document. Ex: "C:\\Docs\\test.doc"
Watermarker watermarker = new Watermarker("test.doc");                                  
                                                                                                 
// watermarking goes here                                                                        
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 12));            
watermarker.add(watermark);                                                                      
                                                                                                 
// Saves the document to the specified stream                                                    
watermarker.save(outputStream);                                                                  
                                                                                                 
watermarker.close();                                                                             
outputStream.close();