PDF zuwa TIFF Converter

Yadda ake canza PDF zuwa TIFF ta amfani da Java

JPG zuwa PDF ko a wata ma’anar Juya Hoton zuwa PDF suna daga cikin ayyukan da ake amfani da su da yawa da jujjuya fayil ɗin tsakanin. Koyaya, ƙila muna da buƙatu don canza PDF zuwa Hoto musamman PDF zuwa TIFF saboda, ana iya adana shafuka masu yawa na PDF azaman hoton TIFF firam mai yawa. Don haka a cikin wannan labarin, za mu tattauna cikakkun bayanai kan yadda ake canza PDF zuwa TIFF ta amfani da Java Cloud SDK.

PDF zuwa TIFF API

Kamar yadda muke neman damar canza fayil ɗin PDF a cikin aikace-aikacen Java, don haka Aspose.PDF Cloud SDK don Java shine tabbataccen zaɓinmu. Yana bawa masu haɓakawa damar aiwatar da ƙirƙirar fayil ɗin PDF, ƙirƙira, magudi da fasalin juzu’i. Ba a buƙatar zazzage software ko shigarwa kuma ana yin duk ayyukan sarrafa fayil ɗin PDF a cikin gajimare. Yanzu don amfani da SDK, muna buƙatar ƙara bayanin sa a cikin aikinmu. Don haka da fatan za a ƙara cikakkun bayanai masu zuwa a cikin pom.xml na nau’in ginin maven.

<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-pdf-cloud</artifactId>
        <version>21.11.0</version>
    </dependency>
</dependencies>

Da zarar an ƙara bayanin SDK zuwa aikin, mataki na gaba shine ƙirƙirar asusun kyauta akan Aspose Cloud. Don haka da fatan za a 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 a cikin sassan da ke gaba.

Canza PDF zuwa TIFF a Java

Canjin PDF zuwa TIFF na iya cika tare da ƙananan layukan layukan. Don haka da fatan za a bi umarnin da aka bayar a ƙasa don cika wannan buƙatu. Da zarar aikin jujjuya PDF zuwa TIFF yayi nasara, ana adana fayil ɗin sakamakon a cikin ma’ajin gajimare.

  • Da farko muna buƙatar ƙirƙirar abu na PdfApi yayin samar da ClientID da sirrin abokin ciniki azaman muhawara
  • Na biyu, shigar da fayil ɗin PDF ta amfani da misalin Fayil
  • Na uku, loda shigar da PDF zuwa ma’ajiyar gajimare ta amfani da hanyar uploadFile(…).
  • Yanzu ƙirƙiri masu canji na kirtani suna riƙe cikakkun bayanan hanya don sakamakon TIFF, da abubuwan Integer waɗanda ke bayyana lambar shafi da girma don hoton TIFF.
  • A ƙarshe kira hanyar putPageConvertToTiff(…) da ke buƙatar shigar da PDF, hanyar sakamakon hoton TIFF, lambar shafi da sigogin zaɓi waɗanda ke ayyana girman fayil ɗin sakamako.
try
    {
    // Samu ClientID da ClientSecret daga https://dashboard.aspose.cloud/
    String clientId = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";
    String clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
	  
    // ƙirƙirar misali na PdfApi
    PdfApi pdfApi = new PdfApi(clientSecret,clientId);

    // sunan shigar da takaddun PDF
    String inputFile = "marketing.pdf";

    // karanta abun ciki na shigar da fayil ɗin PDF
    File file = new File("//Users//"+inputFile);
	    
    // loda PDF zuwa ma'ajiyar gajimare
    pdfApi.uploadFile("input.pdf", file, null);

    // sunan sakamako TIFF image
    String resultant = "Resultant.tiff";
	  
    // takamaiman shafi na PDF don canzawa
    int pageNumber =2;
    
    // Nisa sakamakon hoton TIFF
    int width = 800;
    // Tsayin sakamakon TIFF
    int height = 1024;
	       
    // kira API don Maida PDF zuwa TIFF akan layi
    pdfApi.putPageConvertToTiff("input.pdf", pageNumber, resultant, width, height, null, null);
	    
    // buga sakon nasara
    System.out.println("Convert PDF to TIFF Successsul !");
    }catch(Exception ex)
    {
	      System.out.println(ex);
    }
Canza PDF zuwa TIFF

Hoto 1: - PDF zuwa TIFF Preview Preview

Za a iya sauke samfurin fayil ɗin PDF da aka yi amfani da shi a cikin misalin sama daga marketing.pdf da resultant.tiff

PDF zuwa Hoto ta amfani da Umarnin CURL

Kamar yadda muka sani cewa REST APIs ana iya samun sauƙin shiga ta hanyar umarnin cURL, don haka a cikin wannan sashe, za mu bincika zaɓin yadda ake canza PDF zuwa TIFF ta amfani da umarnin cURL. Yanzu abin da ake buƙata don wannan hanyar shine ƙirƙirar alamar samun damar JWT (bisa ga 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 mun sami alamar JWT, muna buƙatar aiwatar da umarni mai zuwa don adana PDF azaman TIFF. Lura cewa don adana fayil ɗin a gida, muna amfani da gardama -o kawai kuma yana adana fitarwa akan tuƙi na gida.

curl -v -X GET "https://api.aspose.cloud/v3.0/pdf/input.pdf/pages/1/convert/tiff?width=800&height=1024" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>" \
-o resultant.tiff

Kammalawa

Mun bincika zaɓuɓɓukan don canza PDF zuwa TIFF ta amfani da snippet code na Java da kuma ta umarnin cURL. Hakanan kuna iya yin la’akari da bincika samfurin Takardu don ƙarin bincika sauran abubuwan ban sha’awa waɗanda Java Cloud API ke bayarwa. Bugu da ƙari, duk Java Cloud SDK ɗinmu ana buga su ƙarƙashin lasisin MIT, don haka kuna iya yin la’akari da zazzage cikakkiyar lambar tushe daga GitHub kuma gyara ta gwargwadon buƙatunku. A cikin kowane matsala, kuna iya la’akari da kusantar mu don ƙuduri mai sauri ta hanyar [Tallafin tallafin samfur 9.

Labarai masu alaka

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