Gabungke PowerPoint Online

Gabungke PowerPoint | Gabung PPT PPTX nggunakake Java Cloud SDK

Ing artikel iki, kita bakal ngrembug rincian babagan cara nggabungake pirang-pirang PowerPoints dadi siji file presentasi. PowerPoint digunakake kanggo perwakilan informasi lan briefing ing budaya perusahaan, uga digunakake dening wong bisnis lan mahasiswa kanggo preparation slide show. Aspek popularitas liyane yaiku nggawe tutorial, portofolio digital, animasi dhasar, utawa nggawe slide foto. Nanging, nalika tim kerja ing lingkungan sing disebarake, kita bisa uga duwe syarat kanggo nggabungake Presentasi PowerPoint. Dadi, artikel iki nerangake rincian kanggo nggabungake sawetara PowerPoint dadi siji Presentasi nggunakake Java Cloud SDK.

Gabung PowerPoint API

Kanggo nggawe, ngowahi lan ngekspor PPT utawa PPTX kanthi terprogram menyang PDF, JPEG, PNG utawa GIF etc format, kita wis dikembangaké kode kurang API jenenge Aspose.Slides Cloud. Arsitèktur basis REST menehi kekuwatan kanggo nelpon rutin API ing platform apa wae. Saiki kanggo ngleksanakake fitur kanggo nggabungake presentasi PowerPoint ing aplikasi Java, kita wis nggawe khusus Aspose.Slides Cloud SDK kanggo Jawa. Dadi kanggo nggunakake SDK, sampeyan mung kudu nambah referensi ing pom.xml proyek mbangun maven.

<repositories> 
    <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>https://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>

<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-slides-cloud</artifactId>
        <version>22.9.0</version>
    </dependency>
</dependencies>

Sawise referensi SDK wis ditambahake, langkah penting sabanjure yaiku keasliane karo Aspose Cloud. Yen sampeyan ora duwe akun sing wis ana, mangga nggawe akun gratis nggunakake alamat email sing bener. Banjur mlebu nggunakake akun sing mentas digawe lan goleki / gawe ID Klien lan Rahasia Klien ing Cloud Dashboard. Rincian kasebut dibutuhake kanggo tujuan otentikasi ing bagean ing ngisor iki.

Gabungke PowerPoint ing Jawa

Bagean iki nerangake rincian babagan cara nggabungake presentasi powerpoint nggunakake Java Cloud SDK. Elinga yen kanggo nggabungake PowerPoint, PowerPoint input bisa dimuat saka drive lokal, dimuat saka panyimpenan Cloud utawa malah mbukak langsung saka URL web. Mangga tindakake pandhuan kasebut ing ngisor iki.

  • Kaping pisanan, nggawe obyek obyek SlidesApi nalika nyedhiyakake ClientID lan rahasia Klien minangka argumen
  • Kapindho, gawe obyek FileInfo sing nyedhiyakake data kanggo PowerPoint pisanan
  • Katelu, gawe conto ArrayList sing bakal nahan dhaptar file PPT sing bakal digabung
  • Langkah sabanjure yaiku nggawe obyek sing kapisah saka PresentationToMerge kanggo saben PowerPoint sing bakal digabung
  • Saiki kanggo mbukak PowerPoint saka panyimpenan lokal, kita kudu nggunakake nilai REQUEST saka enumerasi PresentationToMerge
  • Kanggo nemtokake slide tartamtu ing PowerPoint sing bakal digabung, kita nggunakake metode setSlides(…).
  • Langkah sabanjure yaiku nyetel urutan file presentasi sing bakal digabung lan kanggo tujuan iki, kita bakal nggunakake obyek OrderedMergeRequest lan nggunakake metode setPresentations (..)
  • Pungkasane nelpon metode mergeAndSaveOnline(…) kanggo nggabungake presentasi powerpoint lan nyimpen file asil ing panyimpenan awan
try
    {	    
        // Entuk ClientID lan ClientSecret saka https://dashboard.aspose.cloud/
	String clientId = "7ef10407-c1b7-43bd-9603-5ea9c6db83cd";
	String clientSecret = "ba7cc4dc0c0478d7b508dd8ffa029845";

	// nggawe conto SlidesApi
	SlidesApi slidesApi = new SlidesApi(clientId,clientSecret);
        
	// Nglumpukake presentasi kanggo gabung.
	FileInfo fileInfo = new FileInfo();
	// maca presentation input 
	fileInfo.setData(Files.readAllBytes(Paths.get("TemplateCV.pptx")));
	// nyetel jeneng sumber PowerPoint
	fileInfo.setName("TemplateCV.pptx");

	// Nggawe List Array saka obyek FileInfo
	List<FileInfo> files = new ArrayList<FileInfo>();
	// nambah obyek FileInfo menyang dhaptar Array
	files.add(fileInfo);

	// Siapke informasi kanggo presentation pisanan kanggo nggabungake.
	PresentationToMerge presentation1 = new PresentationToMerge();
	// maca PowerPoint saka drive lokal
	presentation1.setSource(PresentationToMerge.SourceEnum.REQUEST);
	// nyetel path kanggo file PowerPoint pisanan
	presentation1.setPath("TemplateCV.pptx");
	// nemtokake slide PowerPoint sing kudu digabung
	presentation1.setSlides(Arrays.asList(1, 2));
	       
	// Siapke informasi kanggo presentation pisanan kanggo nggabungake.
	PresentationToMerge presentation2 = new PresentationToMerge();
	presentation2.setPath("Presentation1.pptx");
	// setel rincian sandhi yen PowerPoint dilindhungi sandhi
	///presentation2.setPassword("sandi_ku");
	// nemtokake sumber minangka panyimpenan Cloud
	presentation2.setSource(PresentationToMerge.SourceEnum.STORAGE);

	// Siapke informasi kanggo presentation pisanan kanggo nggabungake.
	PresentationToMerge presentation3 = new PresentationToMerge();
	// path PowerPoint minangka URL web
	presentation3.setPath("https://github.com/aspose-slides-cloud/aspose-slides-cloud-java/blob/master/TestData/test-unprotected.pptx");
	presentation3.setSlides(Arrays.asList(1));
	// nyetel nilai path minangka URL
	presentation3.setSource(PresentationToMerge.SourceEnum.URL);

        // Siapke panjalukan gabungan.
	OrderedMergeRequest request = new OrderedMergeRequest();
	// nyetel urutan gabungan kanggo presentasi PowerPoint
	request.setPresentations(Arrays.asList(presentation1, presentation2));//, presentation3));
  
        // nelpon API kanggo gabungke PowerPoint lan nyimpen output ing panyimpenan Cloud
	slidesApi.mergeAndSaveOnline("Merged.pptx", files, request, "internal");  // mergeOnline(files, request, null);
        
        System.out.println("Merge PowerPoint successful !");
	}catch(Exception ex)
	{
	    System.out.println(ex);
	}
Gabungake pratinjau PowerPoint

Gambar 1: - Gabung PowerPoint Preview

File sampel sing digunakake ing conto ing ndhuwur bisa diundhuh saka TemplateCV.pptx, Presentation1.pptx lan Merged.ppt.

Gabung PowerPoint nggunakake CURL Commands

Prentah cURL minangka platform independen lan bisa dieksekusi ing platform apa wae. Dadi bagean iki nuduhake rincian babagan cara nggabungake presentasi PowerPoint nggunakake perintah cURL. Dadi prasyarat kanggo pendekatan iki, pisanan kita kudu ngasilake token akses JWT (adhedhasar kredensial klien) nalika nglakokake perintah ing ngisor iki.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Sawise kita duwe token JWT, langkah sabanjure yaiku nggabungake presentasi PowerPoint nggunakake printah ing ngisor iki. Wigati dimangerteni manawa ing ngisor iki printah, kita nggabungake slide pertama saka presentasi pertama lan saka presentasi kapindho, slide pertama lan kaping 3 digabung. Gabungan PPTX disimpen ing panyimpenan maya.

curl -v -X PUT "https://api.aspose.cloud/v3.0/slides/merge?outPath=newResultant.pptx" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-H  "Content-Type: application/json" \
-d "{  \"Presentations\": [    {      \"Path\": \"Presentation1.pptx\",      \"Password\": \"string\",      \"Slides\": [        1      ],      \"Source\": \"Storage\"    },    {      \"Path\": \"test-unprotected.pptx\",      \"Password\": \"string\",      \"Slides\": [        1,3      ],      \"Source\": \"Storage\"    }  ]}"

Kesimpulan

Artikel iki wis enlightened kita ing rincian kanggo gabungke presentations PowerPoint nggunakake Java Cloud SDK. Saliyane potongan kode Jawa, kita uga wis sinau babagan rincian babagan cara nggabungake pirang-pirang powerpoint dadi siji nggunakake perintah cURL. Salajengipun, kita saranake njelajah produk Dokumentasi kanggo sinau babagan macem-macem fitur apik tenan sing ditawakake Cloud API. Uga, elinga yen kabeh Cloud SDK kita diterbitake ing lisensi MIT, supaya sampeyan bisa nimbang ngundhuh kode sumber lengkap saka GitHub lan ngowahi miturut kabutuhan sampeyan. Yen ana masalah, sampeyan bisa nimbang nyedhaki kita kanggo resolusi cepet liwat [forum dhukungan produk] gratis 9.

Artikel sing gegandhengan

Mangga bukak link ing ngisor iki kanggo mangerteni sing luwih lengkap babagan: