0

I have created a pdf file on azure storage and now i want to write few contents into the pdf file .

Is it possible so? If yes kindly help me in this regard

Thank You

if not TempBlob.Blob.HasValue() then
        exit;
    WMSMgmt.FindSet();
    cha[1] := 10;
    msVersion := '2015-02-21';
    keyss := WMSMgmt."Azure Key"; //GetAccountAccessKey();
    dateInRfc1123Format := GetUTCDateTimeText(); // <------------ Changed
    requestMethod := 'PUT';

    urlPath := WMSMgmt."Azure Lable Share Name" + '/' + FileName + '?comp=range';//'lables/'

    CanonicalizedResource := ConvertStr(StrSubstNo('/%1/%2', WMSMgmt."Azure Storage Account Name", urlPath), '?=', cha + ':');

    TempBlob.Blob.CreateInStream(InStr, TextEncoding::UTF8);
    content.WriteFrom(InStr);
    ContentLength := TempBlob.Blob.Length;

    ContentHeaders.Clear();
    content.GetHeaders(ContentHeaders);
    ContentHeaders.Add('Content-Length', Format(ContentLength, 0, 9));
    ContentHeaders.Remove('Content-Type');
    request.Content := content;

    Range := 'bytes=0-' + Format(contentLength - 1, 0, 9);

    canonicalizedHeaders := 'x-ms-date:' + dateInRfc1123Format + Format(cha) +
                            'x-ms-range:' + Range + Format(cha) +
                            'x-ms-version:' + msVersion + Format(cha) +
                            'x-ms-write:' + 'update';

    stringToSign := (requestMethod + Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(contentLength, 0, 9) + Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     Format(cha) +
                     canonicalizedHeaders + Format(cha) + // <------------ Changed
                     canonicalizedResource);

    authorizationHeader := 'SharedKey ' + WMSMgmt."Azure Storage Account Name" + ':' + EncryptionManagement.GenerateBase64KeyedHashAsBase64String(stringToSign, keyss, 2);
    uri := StrSubstNo('https://%1.file.core.windows.net/%2', WMSMgmt."Azure Storage Account Name", urlPath);
    request.SetRequestUri(uri);
    request.Method := requestMethod;
    RequestHeader.Clear();
    request.GetHeaders(RequestHeader);
    RequestHeader.Add('Authorization', authorizationHeader);
    RequestHeader.Add('x-ms-date', dateInRfc1123Format);
    RequestHeader.Add('x-ms-range', Range);
    RequestHeader.Add('x-ms-version', msVersion);
    RequestHeader.Add('x-ms-write', 'update');

    client.Send(request, hhtpres);
    if not hhtpres.IsSuccessStatusCode then
        Error(hhtpres.ReasonPhrase);

This is writing contents to a file on azure storage for all formats other than PDF. I want to write contents to PDF file

  • Please edit your question and include the code you have written so far and the issues you are running into with that code. – Gaurav Mantri Mar 02 '20 at 08:59
  • @GauravMantri did – Rahila Syed Mar 02 '20 at 09:10
  • Are you getting an error in the code above? Please edit your question and include that. Also please elaborate `This is writing contents to a file on azure storage for all formats other than PDF. I want to write contents to PDF file`. – Gaurav Mantri Mar 02 '20 at 09:12
  • This code is working fine for writing contents to files like txt, csv and word. What i am trying is there is already a blank pdf file where i want to write contents and it is not giving me error neither i am able to write the contents. – Rahila Syed Mar 02 '20 at 09:17

0 Answers0