You can read all details at:Convert MemoryStream to PDF File or PDF File to MemoryStream in C# VB.NET
Created
January 18, 2021 22:03
-
-
Save aspose-com-gists/166e396658c6aa55e36dfcdaaa9bfb93 to your computer and use it in GitHub Desktop.
C# MemoryStream to File | Convert PDF File to MemoryStream C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inputFile = dataDir + @"Test.pdf"; | |
string fnameppt = dataDir + "Test.pptx"; | |
{ | |
Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(inputFile); | |
using (MemoryStream pptStream = new MemoryStream()) | |
{ | |
pdfDoc.Save(pptStream, Aspose.Pdf.SaveFormat.Pptx); | |
//File.WriteAllBytes(fnameppt, pptStream.ToArray()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Specify HtmlLoadOptions to load input file | |
HtmlLoadOptions options = new HtmlLoadOptions(); | |
var fileName = dataDir + "Test.html"; | |
string pdfFileName = dataDir + "Test.pdf"; | |
Document document = null; | |
// Load input HTML file in MemoryStream | |
using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(File.ReadAllText(fileName)))) | |
{ | |
// Initialize a doument from input MemoryStream | |
document = new Document(ms, options); | |
// Save the MemoryStream to PDF file | |
document.Save(pdfFileName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment