cire hotuna na PDF

Cire hotunan PDF ta amfani da NET REST API.

A zamanin dijital na yau, inda bayanai ke da yawa kuma abubuwan gani suna isar da saƙon yadda ya kamata fiye da kowane lokaci, buƙatun cire hotuna daga PDF ba abu ne mai musa ba. PDFs sanannen tsari ne don raba takardu, kuma galibi waɗannan fayilolin suna ɗauke da mahimman hotuna waɗanda ke buƙatar isar da su ko sake fasalin su. Ko kuna neman amfani da hotuna a cikin gabatarwa, shigar da su cikin rahotanni, ko raba su a kan dandamali daban-daban, ikon cire hotuna daga PDFs kayan aiki ne mai ƙarfi.

Wannan labarin yana mai da hankali kan buƙatun buƙatun cire hoton PDF kuma yana ba da haske kan ingantattun hanyoyin cimma wannan ta amfani da NET Cloud SDK.

NET Cloud SDK don Cire Hotunan PDF

Aspose.PDF Cloud SDK for .NET kayan aiki ne mai ƙarfi wanda ba wai kawai yana ba ku damar cire hotuna da kyau ba amma kuma yana ba da nau’ikan damar sarrafawa da sarrafa su. Takardun PDF. Bugu da ƙari, yana kuma ba da ayyuka da suka wuce hakar hoto, kamar cirewar rubutu, alamar ruwa, ƙarin bayani, da jujjuya takarda.

Yanzu 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 na Kayayyakin sai ku 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.

Cire Hotunan PDF ta amfani da C# .NET

Bari mu mai da hankali kan cikakkun bayanai game da hakar hoto don haɓaka aikin sarrafa takardu da cire bayanan zuwa sabon matakin 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 cire hotunan PDF tare da NET REST API
var response = pdfApi.PutImagesExtractAsJpeg("Instructions-for-Adding-Your-Logo-2.pdf", 1);

// 
if (response != null && response.Status.Equals("OK"))
{
    Console.WriteLine("Operation completed successfully !");
    Console.ReadKey();
}
cire hotuna daga pdf

Duba hotunan PF da aka ciro daga fayil ɗin PDF.

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

PdfApi pdfApi = new PdfApi(clientSecret, clientID);

Ƙirƙiri wani abu na ajin PdfApi yayin ƙaddamar da shaidar abokin ciniki azaman mahawara ta shigarwa.

var response = pdfApi.PutImagesExtractAsJpeg("Instructions-for-Adding-Your-Logo-2.pdf", 1);

Yanzu, kira API don cire hotuna daga shafin farko na takaddun PDF. Bayan nasarar kammalawa, ana adana hotunan JPG da aka ciro a cikin ma’ajin gajimare.

Za a iya sauke samfurin fayilolin PDF da aka yi amfani da su a cikin misalin da ke sama daga [Umarori-for-Adding-Your-Logo-2.pdf](https://www.entnet.org/wp-content/uploads/2021/04/Umardos -don-Ƙara-Logo-Your-2.pdf).

Cire Hotuna daga PDF ta amfani da Umarnin CURL

Cire hotuna daga PDFs ta amfani da Aspose.PDF Cloud da umarnin cURL tsari ne mai sauƙi da inganci. Ta amfani da umarnin cURL, zaku iya aika buƙatun HTTP zuwa Aspose.PDF Cloud API don fara cire hoto ba tare da matsala ba. Wannan tsarin yana sauƙaƙa tsarin, yana ba da damar ingantacciyar hanya don fitar da hotuna daga PDF ba tare da buƙatar ƙididdigewa mai yawa ba.

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"

Yanzu, da fatan za a aiwatar da umarni mai zuwa don cire hotuna daga shafi na 3 na takaddun PDF kuma adana hotunan da aka ciro azaman tsarin JPG a cikin ma’ajiyar gajimare.

curl -v "https://api.aspose.cloud/v3.0/pdf/{inputPDF}/pages/3/images/extract/jpeg?width=0&height=0" \
-X PUT \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-d{}

Sauya ‘inputPDF’ tare da sunan shigar da fayil ɗin PDF da ake samu a cikin ma’ajiyar girgije kuma, maye gurbin ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.

Kammalawa

A ƙarshe, ikon cire hotuna daga takaddun PDF wani muhimmin sashi ne don haɓaka wadataccen abun ciki na gani wanda galibi ke cikin PDFs. Wannan labarin ya bincika hanyoyi biyu masu tasiri don cimma wannan: ta amfani da Aspose.PDF Cloud SDK don NET da kuma yin amfani da Aspose.PDF Cloud tare da umarnin cURL. Don haka, zaɓin tsakanin hanyoyin biyu ya dogara da takamaiman buƙatun aikin, ƙwarewar fasaha, da hanyoyin haɗin kai da aka fi so, samar da masu amfani da sassauci don biyan bukatunsu na musamman.

Hanyoyin haɗi masu amfani

Labarai masu alaka

Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: