Created
May 7, 2025 16:30
-
-
Save aspose-com-gists/6643792c9988c609f890f8323e48612e to your computer and use it in GitHub Desktop.
Convert PPTX to EMF in Java
This file contains hidden or 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
public class main | |
{ | |
public static void main(String[] args) | |
{ | |
// The path to the document directory. | |
String dataDir = "data"; | |
//Out path | |
String resultPath = dataDir + "Result.emf"; | |
// Instantiate a Presentation object that represents a presentation file. https://reference.aspose.com/slides/java/com.aspose.slides/presentation/#Presentation-java.lang.String- | |
Presentation presentation = new Presentation(dataDir + "test.pptx"); | |
try { | |
FileOutputStream fileStream = new FileOutputStream(resultPath); | |
// Saves the first slide as a metafille by calling the writeAsEmf method. https://reference.aspose.com/slides/java/com.aspose.slides/islide/#writeAsEmf-java.io.OutputStream- | |
presentation.getSlides().get_Item(0).writeAsEmf(fileStream); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} catch (FileNotFoundException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} finally { | |
if (presentation != null) presentation.dispose(); | |
} | |
//ExEnd:ConvertToEmf | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment