I have an wpf application working on print function for merging multiple xps documents as single. when working it triggers error as "Cannot perform a read operation in write-only mode."
I have load data from memorystream
xpsDoc = new XpsDocument(pack, CompressionOption.SuperFast, inMemPackageName);
and the i have use merging reference
FixedDocumentSequence sourceSequence = doc.GetFixedDocumentSequence();
foreach (DocumentReference dr in sourceSequence.References)
{
DocumentReference newDocumentReference = new DocumentReference();
newDocumentReference.Source = dr.Source;
(newDocumentReference as IUriContext).BaseUri = (dr as IUriContext).BaseUri;
FixedDocument fd = newDocumentReference.GetDocument(true);
newDocumentReference.SetDocument(fd); seqNew.References.Add(newDocumentReference);
}
and then i have used this code to print
XpsDocumentWriterwriter=PrintQueue.CreateXpsDocumentWriter(printQueue);
DocumentPaginator paginator = seqNew.DocumentPaginator;
if (paginator.PageCount == MassPrintings.Count())
{
writer.Write(seqNew);
}
Please Suggest me a solution