haɗa fayilolin PDF

Koyi yadda ake saka fayilolin PDF ta amfani da NET REST API.

A cikin duniyar da ke mamaye da lambobi, ikon iya haɗawa da haɗa fayiloli PDF da kyau fiye da fasalin da ya dace kawai. Fayilolin PDF sun shahara saboda kasancewarsu na duniya da daidaiton tsari, don haka suna aiki azaman tsarin tafi-da-gidanka don ƙwararru da dalilai na sirri daban-daban. Koyaya, ƙila mu sami buƙatu don haɗa surori na littafi, haɗa sassa daban-daban na rahoto, ko haɗa rasidu cikin rahoton kashe kuɗi ɗaya. Wannan labarin yana zurfafa cikin buƙatar latsawa don haɗa fayilolin PDF inda ba kawai muna haɗa dukkan takaddun ba amma bisa zaɓin zaɓinmu, za mu ƙara zaɓaɓɓun shafuka tsakanin fayilolin PDF guda biyu ta amfani da NET Cloud SDK.

NET Cloud SDK don Sanya Fayilolin PDF

Sanya fayilolin PDF iskar iska ne tare da Aspose.PDF Cloud SDK don NET. Wannan .NET Cloud SDK mai ƙarfi yana ba da tsari mara kyau kuma mai inganci don haɗawa da haɗa PDFs, yana ba ku damar haɗa fayilolin PDF da yawa cikin wahala cikin daftarin aiki guda ɗaya. Hakanan kuna samun damar don tantance wurin da za a haɗa shafuka, yana ba ku cikakkiyar sassauci da iko akan sarrafa takardu. Saboda haka, tare da amfani da wannan SDK, za ku ƙware da fasaha na PDF file appending, inganta daftarin aiki sarrafa da gabatarwa.

Mataki na farko shine ƙara bayanin SDK a cikin aikinmu kuma don wannan dalili, da fatan za a bincika ‘Aspose.PDF-Cloud’ a cikin manajan fakitin NuGet a cikin IDE Studio Visual kuma danna maɓallin ‘Ƙara Kunshin’.

Hakanan kuna buƙatar samun takaddun shaidar abokin ciniki daga cloud dashboard. Idan ba ku da asusun da ke akwai, kawai ƙirƙiri asusun kyauta ta bin umarnin da aka kayyade a kan saurin farawa.

Saka Fayilolin PDF ta amfani da C# .NET

Da fatan za a bi umarnin da aka bayar a ƙasa don daidaita aikin haɗin fayil ɗin PDF ɗinku ta amfani da C# .NET.

// Don ƙarin misalai, https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-dotnet/tree/master/Examples

// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "c71cfe618cc6c0944f8f96bdef9813ac";
string clientID = "163c02a1-fcaa-4f79-be54-33012487e783";

// ƙirƙirar misali na PdfApi
PdfApi pdfApi = new PdfApi(clientSecret, clientID);

// Kira API don Sanya fayilolin pdf
var response = pdfApi.PostAppendDocument("Input.pdf", "FileToAppend.pdf", 1,3);

// 
if (response != null && response.Status.Equals("OK"))
{
    Console.WriteLine("Operation completed successfully !");
    Console.ReadKey();
}
haɗa fayilolin pdf

Preview of Append PDF files aiki.

An bayar a ƙasa akwai cikakkun bayanai game da snippet na sama da aka bayyana.

PdfApi pdfApi = new PdfApi(clientSecret, clientID);

Da fari dai, ƙirƙiri wani abu na ajin PdfApi yayin ƙaddamar da bayanan abokin ciniki azaman mahawara ta shigarwa.

pdfApi.PostAppendDocument("input.pdf", "FileToAppend.pdf", 1,3);

Yanzu, kira API don ƙara shafukan daga fihirisa 1 zuwa 3 na fayil na biyu zuwa takarda ta farko. Fayilolin shigarwa dole ne sun kasance suna samuwa a cikin ma’ajin gajimare.

Haɗa PDFs ta amfani da Umarnin CURL

Sanya fayilolin PDF ta amfani da Aspose.PDF Cloud da umarnin cURL tsari ne mai sauƙi kuma mai inganci. Aspose.PDF Cloud API yana ba ku damar haɗa fayilolin PDF da yawa cikin takarda ɗaya, haɗin kai tare da sauƙi. Ta amfani da umarnin cURL, zaku iya aika buƙatun HTTP zuwa Aspose.PDF Cloud API, fara aiwatar da append ɗin PDF ba tare da matsala ba. Bugu da ƙari kuma, sauƙi da tasiri na umarnin cURL tare da Aspose.PDF Cloud ya sa wannan hanya ta zama hanya mai sauƙi kuma mai karfi don cimma burin fayil ɗin PDF, haɓaka ƙungiyar daftarin aiki da ingantaccen aiki.

Mataki na farko na wannan hanyar shine ƙirƙirar alamar samun damar JWT. Don haka, da fatan za a aiwatar da umarni mai zuwa:

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=163c02a1-fcaa-4f79-be54-33012487e783&client_secret=c71cfe618cc6c0944f8f96bdef9813ac" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Da zarar an ƙirƙiri alamar JWT, da fatan za a aiwatar da wannan umarni don saka shafi na 1, 2 da 3 daga PDF na biyu zuwa fayil ɗin PDF na farko. Bayan aiki mai nasara, ana adana sakamakon PDF a cikin ma’ajin gajimare.

curl -v "https://api.aspose.cloud/v3.0/pdf/{sourcePDF}/appendDocument?appendFile={PDFtoAppend}&startPage=1&endPage=3" \
-X POST \
-H  "accept: application/json" \
-H  "authorization: Bearer {accessToken}" \
-d{}

Sauya ‘sourcePDF’ tare da sunan PDF na farko wanda shafukan da ake buƙatar sakawa. Sauya ‘PDFtoAppend’ tare da sunan fayil ɗin PDF wanda shafukansa ke buƙatar haɗawa da, ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.

Kammalawa

A ƙarshe, haɗawa da haɗa fayilolin PDF sune mahimman matakai don ingantaccen sarrafa takardu da gabatarwa. Mun bincika hanyoyi biyu masu ƙarfi don cimma wannan: yin amfani da Aspose.PDF Cloud SDK don NET da kuma yin amfani da Aspose.PDF Cloud tare da umarnin cURL. Duk hanyoyin biyu suna haifar da haɗe-haɗe kuma shirya takaddun PDF, an haɗa su da juna don biyan takamaiman buƙatu. Zaɓin tsakanin su biyun ya dogara ne akan buƙatun aikin mutum ɗaya, ƙwarewar fasaha, da hanyoyin haɗin kai da aka fi so, suna ba da sassauci don aiwatar da yanayi daban-daban.

Hanyoyin haɗi masu amfani

Labarai masu alaka

Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: