Learn how to Convert PDF to Base64
Created
April 18, 2024 07:23
-
-
Save aspose-com-gists/c241d8b23d6c2f8eb1259c5ddedc92ed to your computer and use it in GitHub Desktop.
Convert PDF to Base64
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
// load PDF with an instance of Document | |
var document = new Document("Document.pdf"); | |
// Add an additional page (optional) | |
// or made any changes to the document | |
document.Pages.Add(); | |
// create Memory Stream | |
var memoryStream = new MemoryStream(); | |
document.Save(memoryStream); | |
// create ByteArray with PDF content | |
var byteArray = memoryStream.ToArray(); | |
// Converts ByteAray to Base64 | |
var Base64Result = Convert.ToBase64String(byteArray); | |
// Show Results | |
Console.WriteLine(Base64Result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment