Learn how to Convert Image to Base64 in Python
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
// Define the path for the working directory. | |
String dir = "/Desktop/"; | |
// Instantiate a FileInputStream object to read input bytes from a file located in the file system. | |
try (FileInputStream fs = new FileInputStream(dir + "encrypted.rar")) { | |
// Create an object of the RarArchiveLoadOptions class. | |
RarArchiveLoadOptions options = new RarArchiveLoadOptions(); | |
// Invoke the setDecryptionPassword method to set password to decrypt the RAR file. | |
options.setDecryptionPassword("p@s$"); | |
// Initialize a new instance of the RarArchive class. | |
try (RarArchive archive = new RarArchive(fs, options)) { |
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
try (FileInputStream fs = new FileInputStream(dir + "sample.rar")) { | |
try (RarArchive archive = new RarArchive(fs)) { | |
// The extract method extracts the entry to the filesystem by the path provided. | |
archive.getEntries().get(0).extract(dir + "sample-1_1.webp"); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
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
String dir = "/Desktop/"; | |
// Create an object of the FileInputStream class to obtain input bytes from a file in a file system. | |
try (FileInputStream fs = new FileInputStream(dir + "sample.rar")) { | |
// Initialize a new instance of the RarArchive class with the input stream. | |
RarArchive archive = new RarArchive(fs); | |
// Call extractToDirectory method to extract the files in the directory. | |
archive.extractToDirectory(dir + "DecompressRar_out"); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} |
Lern how to Convert Publisher to PNG in Java
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
// Define path for the working directory. | |
String dir = "/Desktop/"; | |
// Initialize a new object of the TraditionalEncryptionSettings class with a desired password. | |
TraditionalEncryptionSettings traditionalEncryptionSettings = new TraditionalEncryptionSettings("asdf"); | |
// Instantiate an instance of the ArchiveEntrySettings class. | |
ArchiveEntrySettings archiveEntrySettings = new ArchiveEntrySettings(null,traditionalEncryptionSettings); | |
// Create an object of the Archive class and initialize it with the object of the ArchiveEntrySettings class. | |
try (Archive archive = new Archive(archiveEntrySettings)) { | |
// Call the createEntry method to create single entry within the archive. | |
archive.createEntry("picture.png", dir+"picture.png"); |
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
//sourceFile.eml, sourceFile.emlx, sourceFile.oft | |
MailMessage message = MailMessage.Load("sourceFile.msg"); | |
message.Save("HtmlOutput.html", SaveOptions.DefaultHtml); | |
Document document = new Document("HtmlOutput.html"); | |
// SaveFormat.Png, Bmp, Gif, Jpeg, Tiff | |
document.Save("output.png", SaveFormat.Png); |
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
//DOC DOCM DOCX DOT DOTM DOTX | |
Aspose.Words.Document docx = new Aspose.Words.Document("sourceWordFile.docx"); | |
// Save DOCX file to HTML | |
docx.Save("filepath\\test.html", SaveFormat.Html); | |
// To convert multi pages DOCX documents, export each page to HTML separately using Aspose.Words and then use the below code to convert to PPTX. | |
using (Presentation pptx = new Presentation()){ |
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 book = new Aspose.Cells.Workbook("input.csv"); | |
book.Save("pdfOutput.pdf", Aspose.Cells.SaveFormat.Auto); | |
var document = new Aspose.Pdf.Document("pdfOutput.pdf"); | |
// save document in PPTX format | |
document.Save("output.pptx", SaveFormat.Pptx); |
NewerOlder