I've got a customer who is trying to create a memorystream of a multipage document to send to another process as a PDF.
var pdf = new MemoryStream(); using (var lfSession = new Session()) { var lfRepository = new RepositoryRegistration( LaserficheConfiguration.ServerName, LaserficheConfiguration.RepositoryName); lfSession.LogIn(lfRepository); //Verify if id is a valid Entry. This is here because //GetDocumentInfo throws an error when EntryID is not found rather than returning a null. if (Entry.TryGetEntryInfo(id, lfSession) != null) { var doc = Document.GetDocumentInfo(id, lfSession).GetLatestVersion(); DocumentExporter docExp = new DocumentExporter(); docExp.ExportPdf(doc, ((DocumentInfo)doc).AllPages, PdfExportOptions.None, pdf); } } return File(pdf.ToArray(), "application/pdf", $"{id}.pdf");
So from reading the SDK documentation, it looks like documentexporter.exporter does not support streaming multipage documents in the PDF format.
From the sdk for that method:
Remarks The Export method cannot export multi-page documents to byte arrays, so this method will fail if the specified format is PDF.
So does anyone have any good solutions for this? Do we need to use third party tools like iTextSharp to create the pdf from a tiff stream? Or can you send multiple pages one at a time to the memory stream array and have them show up as a multipage PDF?