Gabatarwa suna taka muhimmiyar rawa wajen sadarwa yadda ya kamata, dabaru, da bayanai. Bugu da ƙari, don sanya waɗannan gabatarwar su zama masu tasiri da ƙwararru, haɗa alamar ruwa na iya yin kowane bambanci. Alamomin ruwa ba wai kawai suna ƙara ƙarin tsaro ga abun ciki ba har ma suna taimakawa wajen yin alama da kariyar haƙƙin mallaka. A cikin wannan labarin, za mu bincika ikon .NET REST API don ƙara hotuna da alamomin ruwa cikin sauƙi a cikin gabatarwar ku Microsoft PowerPoint, yana haɓaka sha’awar gani da gani. barin tasiri mai ɗorewa ga masu sauraron ku.
- API ɗin REST don Gudanar da PPT na PowerPoint
- Ƙara Alamar Rubutu zuwa Slides na PowerPoint ta amfani da C# .NET
- Saka Alamar Ruwa ta Hoto a Gabatarwar PowerPoint ta amfani da Umarnin CURL
API ɗin REST don Gudanar da PPT na PowerPoint
Tare da taimakon Aspose.Slides Cloud SDK don NET, tsarin ƙara alamar ruwa zuwa gabatarwar PowerPoint ([PPT]) (https://docs) .fileformat.com/presentation/ppt/) ko PPTX) ya zama mara wahala kuma ana iya daidaita shi sosai. Wannan API ɗin yana ba ku damar haɗa ayyukan ci-gaba cikin aikace-aikacenku, kuma alamar ruwa ɗaya ce daga cikin fasaloli da yawa da yake bayarwa. Yi amfani da Aspose.Slides Cloud SDK don ƙara hoto da alamomin ruwa cikin sauƙi a cikin gabatarwar ku tare da ƴan layukan lamba, adana lokaci da ƙoƙari mai mahimmanci na ci gaba.
Yanzu don farawa da wannan fasalin, mataki na farko shine ƙara ambaton Cloud SDK a cikin maganin NET ɗin mu. Don haka, bincika ‘Aspose.Slides-Cloud’ a cikin manajan fakitin NuGet kuma danna maɓallin ‘Ƙara Kunshin’. Na biyu, ziyarci allon dashboard kuma sami keɓaɓɓen shaidar abokin ciniki.
Idan ba ku da asusun da ke akwai, kawai ƙirƙiri asusun kyauta ta bin umarnin da aka ƙayyade a cikin jagorar saurin farawa.
Ƙara Alamar Rubutu zuwa Slides na PowerPoint ta amfani da C# .NET
Wannan sashe yana bayyana cikakkun bayanai game da ƙari na alamar ruwa zuwa gabatarwar PowerPoint C# .NET.
// Don ƙarin misalai, da fatan za a ziyarci https://github.com/aspose-slides-cloud
// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "7f098199230fc5f2175d494d48f2077c";
string clientID = "ee170169-ca49-49a4-87b7-0e2ff815ea6e";
// ƙirƙirar misali na SlidesApi
SlidesApi slidesApi = new SlidesApi(clientID, clientSecret);
// Shigar da gabatarwar PowerPoint daga faifan gida
String inputFile = "convertedFile.pptx";
// loda abun ciki na PPT a cikin misali rafi
var inputPowerPoint = System.IO.File.OpenRead(inputFile);
// Cikakkun bayanai na tsara alamar ruwa
// tsayin rubutu don alamar ruwa ta rubutu
int fontHeight = 30;
// Abun rubutu da za a ƙara azaman alamar ruwa
string watermarkText = "Confidential !";
// sunan font da za a yi amfani da shi don alamar ruwa
string fontName = "Arial";
// launi na gaba don rubutun alamar ruwa
string fontColor = "Red";
// kira API don ƙara alamar ruwa ta rubutu zuwa duk nunin gabatarwar PowerPoint
var response = slidesApi.CreateWatermarkOnline(inputPowerPoint,null,fontHeight, watermarkText, fontName, fontColor);
// Hanyar kira don adana fitarwa a kan tuƙi na gida
saveToDisk(response, "/Users/nayyer/watermarked.pptx");
// hanya don adana abun ciki na rafi zuwa fayil akan faifan gida
public static void saveToDisk(Stream responseStream, String resultantFile)
{
var fileStream = File.Create(resultantFile);
responseStream.Seek(0, SeekOrigin.Begin);
responseStream.CopyTo(fileStream);
fileStream.Close();
}
An ba da cikakkun bayanai game da snippet code na sama.
SlidesApi slidesApi = new SlidesApi(clientID, clientSecret);
Da farko, ƙirƙiri misali na ajin SlidesApi inda muke ƙaddamar da shaidar abokin ciniki azaman muhawara.
String inputFile = "convertedFile.ppt";
var inputPowerPoint = System.IO.File.OpenRead(inputFile);
Loda abun ciki na gabatarwar PowerPoint a cikin misalin rafi.
var response = slidesApi.CreateWatermarkOnline(inputPowerPoint,null,fontHeight, watermarkText, fontName, fontColor);
Kira API don ƙara alamar ruwa ta rubutu zuwa duk nunin nunin nunin PowerPoint.
saveToDisk(result, "/Users/nayyer/watermarkPowerPoint.pptx");
Hanya ta al’ada don adana sakamakon ruwa mai alamar PowerPoint PPTX akan faifan gida.
Saka Alamar Ruwa ta Hoto a Gabatarwar PowerPoint ta amfani da Umarnin CURL
Yayin da Aspose.Slides Cloud SDK for .NET yana ba da cikakkiyar bayani mai dacewa da mai amfani don ƙara alamar ruwa zuwa gabatarwar PowerPoint, kuna iya cimma daidai da ta amfani da umarnin cURL da Aspose.Slides Cloud REST API. Mun san cewa umarnin cURL suna ba da hanyar haɗin yanar gizo don yin hulɗa tare da API kai tsaye, don haka ya zama madadin aiki ta kayan aikin layin umarni.
Mataki na farko tare da wannan hanyar shine samar da 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 an ƙirƙiri alamar JWT, da fatan za a aiwatar da wannan umarni don saka alamar ruwa a cikin gabatarwar PowerPoint:
curl -v "https://api.aspose.cloud/v3.0/slides/{inputPPTX}/watermark/image" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: multipart/form-data" \
-d {"image":@{"aspose.png"}}
Sauya inputPPTX
tare da sunan shigar da PowerPoint PPTX da aka riga an samu a ma’ajiyar girgije, da ‘accessToken’ tare da alamar JWT da aka samar a sama.
Kammalawa
A ƙarshe, ƙara alamar ruwa zuwa gabatarwar PowerPoint abu ne mai mahimmanci wanda ke haɓaka sha’awar gani da alamar nunin faifan ku. Tare da ƙarfi Aspose.Slides Cloud SDK don NET, zaku iya haɗa alamun ruwa ba tare da wahala ba, ko hotuna ne ko rubutu, cikin fayilolin PowerPoint ɗinku, kuna ba su ƙwararrun taɓawa. Babban iyawar SDK, kamar girman rubutu, sunan rubutu da sauran sigogi suna ba da sassauci wajen keɓance alamun ruwa don biyan takamaiman buƙatunku.
Hanyoyin haɗi masu amfani
Labarai masu alaka
Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: