Hi Team,
Hi Jyothi,
Thanks for your inquiry. Aspose APIs support to load documents from streams and save to streams as well. So you can save PDF output from Aspose.Cells and Aspose.Words to stream, and later can concatenate multiple PDF streams into a single stream. Please check following documentation link for concatenation PDF streams.
Please feel free to contact us for any further assistance.
Best Regards,
Hi Ahmad,
Hi Jyothi,
Thanks for your feedback. As per your requirement you can convert DOC document as stream into PDF as stream as following. You can use respective constructors of Aspose.Cells for loading Excel document from stream and convert it into PDF as stream.
// Load the Word document from a memory stream
Aspose.Words.Document doc = new Aspose.Words.Document(DocMemoryStream);
// Create a memory stream to hold the PDF output
MemoryStream pdfMemoryStream = new MemoryStream();
// Save the document to the memory stream in PDF format
doc.Save(pdfMemoryStream, Aspose.Words.SaveFormat.Pdf);
// Reset the position of the memory stream for further use
pdfMemoryStream.Position = 0;
// Example: Write the memory stream to a file (optional)
using (FileStream fileStream = new FileStream("c:/pdftest/ConvertedDocument.pdf", FileMode.Create, FileAccess.Write))
{
pdfMemoryStream.CopyTo(fileStream);
}
Console.WriteLine("Document successfully converted to PDF and saved in memory stream.");
Please feel free to contact us for any further assistance.
Best Regards,
Thank You !!
Hi Jyothi,
Hi ahmad
The code snippet is not working for me while saving the document as pdfmemorystream.
import com.aspose.pdf.internal.imaging.system.io.MemoryStream;
Document doc = null;
MemoryStream pdfMemoryStream = new MemoryStream();
System.out.println("aspose operations ");
switch (extension) {
case “docx”:
System.out.println("in doc case : ");
try {
doc = new Document(docStream);
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_B);
//doc.save(newPath,options);
doc.save(pdfMemoryStream, SaveFormat.PDF);
} catch (Exception e) {
System.err.println(e);
}
Please help …
It seems like you are trying to load a .doc/.docx file in Document(). Please note that Aspose.PDF does not support Word to PDF conversion. You can however convert a PDF into DOC/DOCX using the API. Please let us know in case we have missed something and share your sample source file with us. We will further proceed to assist you accordingly.