Cire Hotuna daga PowerPoint

Cire Hotunan PPT ta amfani da Java Cloud SDK

Gabatarwa PowerPoints yawanci ya ƙunshi Rubutu, Hotuna, Charts, Siffai da sauransu kuma muna iya samun buƙatu don cire hotunan PPT kawai don ƙarin aiki. Don haka a cikin wannan labarin, za mu tattauna cikakkun bayanai kan yadda ake cire hotuna daga PPTX akan layi ta amfani da Java Cloud SDK. API ɗin yana ba da damar haɓaka hotuna a ƙayyadadden tsari wanda ya haɗa da JPEG, PNG, GIF, BMP ko TIFF. Bugu da ƙari, don fitar da hotuna, za mu iya ko dai loda gabatarwar daga ma’ajiyar girgije ko loda shi daga faifan gida.

API ɗin Mai sarrafa PowerPoint

Aspose.Slides Cloud tushen API ne na REST yana ba da damar ƙirƙira, sarrafa PPT da canza PowerPoint zuwa wasu nau’ikan da aka goyan baya. Yanzu don amfani da fasalin sarrafa PowerPoint iri ɗaya a cikin aikace-aikacen Java, Aspose.Slides Cloud SDK don Java ingantaccen bayani ne. Kundin sa a kusa da Cloud API kuma ana iya haɗa shi cikin sauƙi a aikace-aikacen Java ta ƙara bayanin sa ta fayil ɗin pom.xml.

<repositories> 
    <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>http://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>

Idan baku da asusun da ke wanzu akan Aspose Cloud, da fatan za a ƙirƙiri asusun kyauta ta amfani da adireshin imel mai inganci. Sannan shiga ta amfani da sabon asusun da aka ƙirƙira kuma bincika/ƙirƙiri ID na abokin ciniki da Sirrin Abokin ciniki a Cloud Dashboard. Ana buƙatar waɗannan cikakkun bayanai don dalilai na tantancewa a cikin sassan masu zuwa.

Cire hotunan PPT a cikin Java

Wannan sashe yana bayyana cikakkun bayanai kan yadda ake cire hotunan PPT ta amfani da snippet code na Java. Za mu loda PowerPoint daga ajiyar girgije kuma za mu cire duk hotuna daga PowerPoint. Ana mayar da Hotunan da aka ciro azaman rumbun adana bayanai guda .zip. Da fatan za a bi umarnin da aka ƙayyade a ƙasa.

  • Da farko, ƙirƙiri wani abu na SlidesApi yayin samar da ClientID da sirrin Abokin ciniki azaman muhawara.
  • Na biyu, ƙirƙiri misalin Fayil wanda ke ɗaukar adireshin shigarwar fayil ɗin samfuri na PowerPoint azaman siga
  • Abu na uku, karanta abubuwan da ke cikin fayilolin PowerPoint ta amfani da readAllBytes(…) sannan ka adana shi cikin tsararrun byte[]
  • Mataki na gaba shine loda PPT zuwa ma’ajiyar gajimare ta amfani da hanyar uploadFile(…).
  • A ƙarshe kira hanyar zazzagewa Images(…) yayin samar da ƙimar ƙididdiga ta ImageExportFormat.JPEG domin a fitar da hotuna a tsarin JPG.
https://github.com/aspose-slides-cloud/aspose-slides-cloud-java
try
    { 
        // Samu ClientID da ClientSecret daga https://dashboard.aspose.cloud/
	String clientId = "7ef10407-c1b7-43bd-9603-5ea9c6db83cd";
	String clientSecret = "ba7cc4dc0c0478d7b508dd8ffa029845";

	// ƙirƙirar misali na SlidesApi
	SlidesApi slidesApi = new SlidesApi(clientId,clientSecret);
		        
	// loda fayil daga tsarin gida
	File f = new File("tf03431377_win32.potx");

	// load farko gabatarwar PowerPoint
	byte[] bytes = Files.readAllBytes(f.toPath());
	slidesApi.uploadFile("input.potx", bytes, null);
      
        // Cire duk hotuna a tsarin JPEG
	File imageFile = slidesApi.downloadImages("input.potx", ImageExportFormat.JPEG, null, null, null);

	// buga sakon nasara
	System.out.println("Extracted images are saved to " + imageFile.getPath());
    }catch(Exception ex)
    {
	System.out.println(ex);
    }
Cire samfotin hotuna na PowerPoint

Hoto1:- Cire Siffar Hotunan PPT

Za a iya sauke samfurin gabatarwar samfurin da aka yi amfani da shi a cikin misalin sama daga RainbowPresentation.potx.

Cire Hotuna daga PPTX ta amfani da Umarnin CURL

Yanzu bari mu bincika cikakkun bayanai kan yadda ake cire hotuna daga PPTX akan layi ta amfani da umarnin cURL. Don haka mataki na farko shine samar da alamar samun damar JWT (dangane da shaidar abokin ciniki) yayin aiwatar da umarni mai zuwa.

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"

Da zarar muna da alamar JWT, da fatan za a aiwatar da umarni mai zuwa zuwa mataki na gaba shine haɗa gabatarwar PowerPoint ta amfani da umarni mai zuwa. Lura cewa a bin umarni, muna ciro duk hotunan PowerPoint a cikin tsarin JPEG. Hotunan da aka ciro ana ajiye su zuwa faifan gida a cikin tsarin .zip Archive.

curl -v -X POST "https://api.aspose.cloud/v3.0/slides/input.potx/images/download/Jpeg" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-o output.zip

Kammalawa

Wannan labarin ya bayyana cikakkun bayanai kan yadda ake cire hotunan PPT ta amfani da Java Cloud SDK. A lokaci guda, tun da API ɗin ya dogara ne akan gine-gine na REST, don haka za mu iya samun dama gare shi ta hanyar umarnin cURL don cim ma buƙatu iri ɗaya. Baya ga wannan fasalin, API ɗin yana ba da fasali da yawa don haka, muna ba da shawarar bincika samfur Takardu. Hakanan, da fatan za a lura cewa ana buga duk SDK ɗin mu a ƙarƙashin lasisin MIT, don haka kuna iya yin la’akari da zazzage cikakkiyar lambar tushe daga GitHub kuma gyara ta gwargwadon buƙatun ku. A cikin kowane matsala, kuna iya la’akari da kusantar mu don ƙuduri mai sauri ta hanyar [Tallafin tallafin samfur 9.

Labarai masu alaka

Da fatan za a ziyarci hanyoyin haɗin yanar gizon don ƙarin koyo game da: