0

我在 azure 存储上创建了一个 pdf 文件,现在我想在 pdf 文件中写入一些内容。

有可能吗?如果是,请在这方面帮助我

谢谢你

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);

这是将内容写入 Azure 存储上除 PDF 之外的所有格式的文件。我想将内容写入 PDF 文件

4

0 回答 0