Kalma zuwa Hoto

Canza Kalma zuwa Takardun TIFF a Java

Akwai buƙatu mai girma don ingantaccen kuma dacewa da mafita na jujjuya daftari. Muna amfani da takaddun MS Word don ajiyar bayanan hukuma da na sirri. Hakanan suna ɗaya daga cikin shahararrun tsarin fayil don raba bayanan hukuma ta kamfanoni, jami’a da ƙungiyoyin gwamnati. Yanzu, don hana takardu daga magudi mara izini, zamu iya canza Kalma zuwa Hoto. Don haka a cikin wannan labarin fasaha, za mu mai da hankali musamman kan yadda ake canza takaddun Kalma zuwa hotuna TIFF ta amfani da Java REST API.

Wannan labarin yana bawa masu haɓakawa damar haɗa ƙarfin juzu’i cikin sauri da sauƙi a cikin aikace-aikacen su, yana ba da damar canza Kalma zuwa Tiff, Kalma zuwa hoto, Kalma zuwa hoto, ko DOC zuwa Tiff tare da ƴan layukan lamba.

API ɗin Canjin Kalma zuwa Hoto

Aspose.Words Cloud SDK don Java API ne na REST wanda ke ba da kewayon fasalolin sarrafa takardu, gami da ikon canza takaddun Kalma zuwa hotuna TIFF. Tare da hanyar sadarwa mai sauƙi da sauƙi don amfani, masu haɓakawa za su iya aiwatar da wannan aiki cikin sauri da sauƙi a cikin aikace-aikacen su na Java, ba tare da damuwa game da rikitattun fassarar takarda ba. Gabaɗaya, kayan aiki ne mai ƙarfi don canza takaddun Kalma zuwa hotuna TIFF, PDF, Kalma zuwa JPG, Kalma zuwa HTML, da sauran nau’ikan nau’ikan fayilolin tallafi 12 ]. Tare da API ɗinsa madaidaiciya da zaɓuɓɓukan da za a iya daidaita su, zaku iya aiwatar da wannan aikin cikin sauƙi a cikin aikace-aikacenku kuma ku daidaita hanyoyin canza daftarin aiki.

Yanzu, don amfani da SDK, da fatan za a ƙara cikakkun bayanai a cikin pom.xml na nau’in ginin 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-words-cloud</artifactId>
        <version>22.8.0</version>
    </dependency>
</dependencies>

Da zarar an ƙara bayanin JDK zuwa aikin, muna buƙatar ƙirƙirar asusun kyauta akan Aspose Cloud. Yanzu nemo ID na Abokin ciniki da Sirrin Abokin ciniki a Dashboard.

Canza Kalma zuwa Takardun TIFF a Java

A cikin wannan sashe, za mu canza Kalma zuwa Hoto (takardar TIFF) ta amfani da snippet code na Java. Za a loda daftarin kalmar tushe daga ma’ajiyar gajimare kuma bayan juyawa, za’a adana shi a cikin ma’ajiyar girgije iri ɗaya.

  • Da farko, ƙirƙiri wani abu na WordsApi inda muka wuce ID ɗin abokin ciniki da Sirrin Abokin ciniki azaman sigogi.
  • Abu na biyu, karanta shigarwar daftarin aiki Word daga faifan gida ta amfani da abin Fayil.
  • Na uku, ƙirƙiri misalin UploadFileRequest wanda ke buƙatar misalin Fayil azaman hujja.
  • Yanzu kira hanyar uploadFile(…) don loda daftarin aiki zuwa ga ma’ajiyar girgije.
  • Ƙirƙiri wani abu na GetDocumentWithFormatRequest(…) yayin samar da sunan shigar daftarin aiki na Kalma, ƙimar tsarin fitarwa azaman TIFF, da sunan fayil ɗin sakamakon azaman muhawara.
  • A ƙarshe, kira hanyar getDocumentWithFormat(…) don canza Kalma zuwa Hoto da adana abin fitarwa a cikin ma’ajiyar girgije.
// Don ƙarin snippets na lamba, da fatan za a https://github.com/aspose-words-cloud/aspose-words-cloud-java

    // Samu ClientID da ClientSecret daga https://dashboard.aspose.cloud/
    String clientId = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
    String clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
    try
	{
        // ƙirƙirar wani abu na WordsApi
        // idan baseUrl ba shi da amfani, WordsApi yana amfani da tsoho https://api.aspose.cloud
        WordsApi wordsApi = new WordsApi(clientId, clientSecret, null);

        // karanta abubuwan da ke cikin PDF daga faifan gida
        File file = new File("C:\\input.docx");
        
        // ƙirƙirar buƙatar loda fayil
        UploadFileRequest uploadRequest = new UploadFileRequest(Files.readAllBytes(file.toPath()), "input.docs", null);
        
        // loda fayil zuwa ma'ajiyar girgije
        wordsApi.uploadFile(uploadRequest);
            
        // ƙirƙiri abin buƙatun daftarin aiki yayin tantance sunan tiff na sakamakon
        GetDocumentWithFormatRequest request = new GetDocumentWithFormatRequest("input.docx", "TIFF", "", "default","", "", "", "Converted.tiff","");
            
        // Kira API don musanya Kalma zuwa Hoto (TIFF) da adana fitarwa a cikin ma'ajin gajimare
        wordsApi.getDocumentWithFormat(request);
        
        System.out.println("Sucessfully converted Word to TIFF document !");
	}catch(Exception ex)
	{
	    System.out.println(ex);
	} 
Kalma zuwa TIFF samfoti

Hoto1: - Kalma zuwa TiFF samfoti na Juya

Samfurin daftarin aiki na Kalma da aka yi amfani da shi a cikin misalin da ke sama za a iya saukewa daga testmultipages.docx da sakamakon TIFF daga Converted.tiff.

Kalma cikin Hoto ta amfani da Umarnin CURL

A cikin wannan sashe, za mu yi amfani da umarnin cURL don Kalma zuwa fassarar Hoto. Yanzu, mataki na farko shine ƙirƙirar alamar samun damar JWT 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, don Allah umarni mai zuwa don loda daftarin aiki daga ma’ajin gajimare kuma a adana a cikin takaddar TIFF. Sakamakon TIFF kuma ana adana shi a cikin ajiyar girgije.

curl -v -X GET "https://api.aspose.cloud/v4.0/words/Resultant.docx?format=TIFF&outPath=converted.tiff" \
-H  "accept: application/octet-stream" \
-H  "Authorization: Bearer <JWT Token>"

Kammalawa

A ƙarshe, canza takaddun Kalma zuwa hotuna TIFF aiki ne mai mahimmanci ga yawancin masu haɓakawa, kuma Aspose.Words Cloud SDK don Java yana sa wannan aikin ya fi sauƙi fiye da kowane lokaci. Tare da ƙarfin REST API ɗin sa da zaɓuɓɓukan da za a iya daidaita su, masu haɓakawa za su iya haɗa ƙarfin juzu’i cikin sauri da sauƙi cikin aikace-aikacen Java ɗin su. Ko kuna buƙatar canza takarda guda ɗaya ko babban nau’in takardu, Aspose.Words Cloud SDK don Java yana ba da ingantaccen bayani mai inganci don canza Kalma zuwa hotuna TIFF. Don haka, idan kuna neman ƙaƙƙarfan bayani mai jujjuya daftarin aiki mai amfani don aikace-aikacen Java ɗinku, to, Aspose.Words Cloud SDK don Java tabbas ya cancanci bincika.

Hakanan, ana buga cikakken lambar tushe na SDK akan GitHub kuma ana iya saukewa kyauta. Hakanan kuna iya la’akari da samun dama ga API a cikin mai binciken gidan yanar gizo ta SwaggerUI. A ƙarshe, idan kun ci karo da kowace matsala yayin amfani da APIs, da fatan za ku ji daɗin tuntuɓar mu ta [ dandalin tallafin samfur 9.

Labarai masu alaka

Muna ba da shawarar ziyartar hanyoyin haɗin yanar gizo masu zuwa don ƙarin koyo game da: