Aggiungere una filigrana a una presentazione PPTX con Java
Crea applicazioni Java che inseriscono filigrane di testo o immagine nei file di presentazione con API lato server.
Aggiungere una filigrana a una presentazione PPTX tramite Java
Con Aspose.Slides for Java puoi aggiungere filigrane di testo e immagine alle presentazioni PPTX. Aggiungi una forma di filigrana a una diapositiva master, così la filigrana compare nelle diapositive che usano quel master.
Aggiungere una filigrana di testo a PPTX con Java
Presentation presentation = new Presentation("presentation.pptx");
try {
IMasterSlide masterSlide = presentation.getMasters().get_Item(0);
IAutoShape watermarkShape = masterSlide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 400, 120);
ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("Watermark");
watermarkTextFrame.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().setFontHeight(48);
presentation.save("watermark.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}Aggiungere una filigrana immagine a una presentazione PPTX con Java
Presentation presentation = new Presentation("presentation.pptx");
try {
byte[] imageData = Files.readAllBytes(Paths.get("watermark.png"));
IPPImage watermarkImage = presentation.getImages().addImage(imageData);
IMasterSlide masterSlide = presentation.getMasters().get_Item(0);
IAutoShape watermarkShape = masterSlide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 300, 200);
watermarkShape.getFillFormat().setFillType(FillType.Picture);
watermarkShape.getFillFormat().getPictureFillFormat().getPicture().setImage(watermarkImage);
watermarkShape.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);
presentation.save("image-watermark.pptx", SaveFormat.Pptx);
} finally {
presentation.dispose();
}Come aggiungere una filigrana a PPTX con Java
Segui questi passaggi per aggiungere una filigrana di testo o immagine ai file PPTX.
- Carica il file
PPTXcon la classePresentation. - Seleziona una diapositiva master con il metodo
getMasters. - Chiama il metodo
addAutoShapeper aggiungere una forma di filigrana. - Chiama il metodo
addTextFrameper aggiungere il testo della filigrana oppure usaaddImageper una filigrana immagine. - Salva la presentazione con filigrana in formato PPTX.
Realizzato con Aspose.Slides
Aggiungi filigrane a file PPTX online
L’app gratuita Aspose.Slides Watermark è realizzata con Aspose.Slides for Java, la stessa API del codice sopra. Aprila e scopri cosa può fare l’API con i tuoi file PPTX.
- Funziona nel browser, senza installare nulla.
- Scopri come Aspose.Slides aggiunge le filigrane prima di scrivere codice.
- Aggiungi una filigrana di testo o immagine al tuo file PPTX.
- Scarica il file con filigrana.
Altri formati supportati per le filigrane
Con Java puoi aggiungere filigrane anche ai seguenti formati.