mpp zuwa pdf

Yadda ake canza MS Project (MPP) zuwa PDF ta amfani da NET REST API.

A cikin duniyar kasuwanci mai saurin tafiya ta yau, ingantaccen gudanar da ayyuka yana da mahimmanci. Microsoft Project kayan aiki ne ga masu sarrafa ayyuka da yawa, yana basu damar tsarawa, aiwatarwa, da saka idanu akan ayyukan yadda ya kamata. Koyaya, raba bayanan aikin tare da membobin ƙungiyar da masu ruwa da tsaki ba koyaushe bane mai sauƙi. Wannan shine inda juyawa [MPP] (https://docs.fileformat.com/project-management/mpp/) zuwa [PDF] (https://docs.fileformat.com/pdf/) ya zo wurin ceto. Mayar da fayilolin MPP zuwa tsarin PDF yana ba da mafita mai mahimmanci, yana tabbatar da cewa kowa zai iya dubawa da haɗin kai akan ayyukan ku cikin sauƙi. Don haka, bari mu bincika mahimman tsari na canza MPP zuwa PDF ta amfani da .NET REST API kuma mu fallasa fa’idodin da yake bayarwa.

NET Cloud SDK don Canjawar MPP zuwa PDF

Aspose.Tasks Cloud SDK for .NET shine kayan aikin mu na lashe lambar yabo don canza MPP zuwa tsarin PDF. Wannan SDK ba kawai game da canza MPP zuwa PDF ba ne, amma yana da cikakkiyar maganin sarrafa aikin a cikin gajimare. Tare da faffadan fasalulluka, yana sauƙaƙe tsara ayyuka, tsarawa, da saka idanu, yayin da kuma ba ku damar sarrafa bayanan aikin ku ba tare da matsala ba. Bari mu nutse cikin tsari-mataki-mataki kuma mu shaida yadda wannan SDK zai iya aiwatar da waɗannan ayyuka ba tare da wahala ba.

Bincika ‘Aspose.Tasks-Cloud’ a cikin manajan fakitin NuGet kuma danna maɓallin ‘Ƙara Kunshin’. Wannan zai ƙara bayanin SDK a cikin aikin ku. Na biyu, sami takaddun shaidar abokin ciniki daga dashboard ɗin girgije.

Idan ba ku da asusun da ke akwai, kawai ƙirƙirar asusun kyauta ta bin umarnin da aka kayyade a cikin labarin saurin farawa.

Maida MPP zuwa PDF a cikin C#

Bari mu bi umarnin da aka ba kasa don yin MS Project (MPP) zuwa PDF hira ta amfani da C# .NET.

TasksApi tasksApi = new TasksApi(clientSecret, clientID);

Ƙirƙiri wani abu na ajin TasksApi yayin wucewa da bayanan abokin ciniki azaman mahawara ta shigarwa.

GetTaskDocumentWithFormatRequest formatRequest = new GetTaskDocumentWithFormatRequest()
{
    Format = ProjectFileFormat.Pdf,
    Name = inputFile 
    ReturnAsZipArchive = false
};

Ƙirƙiri misalin Buƙatar inda muka ƙididdige sunan shigar da MPP, tsarin sakamako azaman PDF da kadarorin don kar a adana fitarwa azaman tarihin zip.

var output = tasksApi.GetTaskDocumentWithFormat(formatRequest);

A ƙarshe, kira API don canza MPP zuwa PDF akan layi kuma dawo da fitarwa a cikin misalin rafi.

saveToDisk(finalResponse, resultant);

Hanyar mu ta al’ada tana ba da damar adana sakamakon PDF akan faifan gida.

// Don ƙarin misalai, da fatan za a ziyarci https://github.com/aspose-tasks-cloud/aspose-tasks-cloud-dotnet

// Samu bayanan abokin ciniki daga https://dashboard.aspose.cloud/
string clientSecret = "4d84d5f6584160cbd91dba1fe145db14";
string clientID = "bb959721-5780-4be6-be35-ff5c3a6aa4a2";

// ƙirƙirar misalin TasksApi
TasksApi tasksApi = new TasksApi(clientSecret, clientID);

// Sunan shigar da fayil MPP
String inputFile = "Home move plan.mpp";
// sunan resultant PDF file
String resultant = "output.pdf";

// ƙirƙiri buƙatun sauya fayil MPP
GetTaskDocumentWithFormatRequest formatRequest = new GetTaskDocumentWithFormatRequest()
{
    Format = Aspose.Tasks.Cloud.Sdk.Model.ProjectFileFormat.Pdf,
    Name = inputFile,
    // ba za a adana sakamakon da aka samu azaman tarihin zip ba
    ReturnAsZipArchive = false
};

// Yi canjin MPP zuwa PDF kuma dawo da fitarwa azaman misali rafi
var output = tasksApi.GetTaskDocumentWithFormat(formatRequest);

// Hanyar al'ada don adana sakamakon fayil a kan tsarin gida
saveToDisk(response, resultant);

// 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();
}

Za a iya sauke samfurin fayil ɗin MPP da aka yi amfani da shi a cikin misalin da ke sama daga Shirin aikin gine-gine na kasuwanci.mpp.

Ajiye MPP azaman PDF ta amfani da Umarnin CURL

Ga waɗanda suka fi son tsarin layin umarni, za mu bincika cikakkun bayanai kan yadda ake yin canjin MPP zuwa PDF ta amfani da Aspose.Tasks Cloud tare da cURL umarni. Kamar yadda SDK ke ba da mafita mai sassauƙa don haɗawa cikin ayyukanku, kuma tare da cURL, zaku iya sarrafa tsarin yadda ya kamata. Wannan sashe yana jagorantar ku ta hanyar matakai don yin wannan jujjuya mai inganci da wahala.

Mataki na farko a wannan hanyar shine samar da alamar samun damar JWT ta amfani 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 fatan za a aiwatar da umarni mai zuwa don fitarwa fayil ɗin MS Project (MPP) zuwa tsarin PDF.

curl -X GET "https://api.aspose.cloud/v3.0/tasks/{sourceMPP}/format?format=pdf" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <accessToken>" \
-o {resultantFile}

Sauya sourceMPP tare da sunan shigar da fayil MPP samuwa a cikin Cloud ajiya, `resultantFile’ tare da sunan fitarwa PDF da ‘accessToken’ tare da alamar samun damar JWT da aka samar a sama.

Kammalawa

A ƙarshe, mun zurfafa cikin hanyoyi biyu masu inganci don canza fayilolin MPP zuwa tsarin PDF. Hanya ta farko ta nuna ƙarfi da haɓakar Aspose.Tasks Cloud SDK don NET, yana ba da hanya mai sauƙi kuma cikakke don yin wannan jujjuyawar. Hanya ta biyu, ta amfani da umarnin cURL tare da Aspose.Tasks Cloud, yana ba da madadin layin umarni ga waɗanda suka fi son aiki da kai. Ko kun zaɓi SDK ko umarnin cURL, kuna da kayan aikin da kuke da su don canza fayilolin MPP zuwa PDF ba tare da ɓata lokaci ba, suna haɓaka ikon sarrafa takaddun ku.

Hanyoyin haɗi masu amfani

Labarai masu alaka

Muna ba da shawarar ziyartar shafukan yanar gizo masu zuwa: