#1 2020-07-10 22:03:08

Wolfgang Haefele
Member
Registered: 2020-07-10
Posts: 1

SynPDF Encryption makes Document Information unreadable

I have to generate a encrypted pdf with user limitations, this works generally fine. There is only one issue regarding the TPdfDocumentGDI.Info properties like Author, Subject and Title. These properties are not readable any more by Adobe Acrobat in case of activated encryption. I searched the forum and nobody besides me seems to face this issue. Maybe someone can tell me what I am doing wrong.

The relevant code is:

function GetPdfDoc(Subject:string; Title:string; FileName:string=''):TPdfDocumentGDI;
begin
  if CfgSettings.PdfPassword = '' then Result := TPdfDocumentGDI.Create // no encryption
  else Result := TPdfDocumentGDI.Create(false,0,false,TPdfEncryption.New(elRC4_128,'',CfgSettings.PdfPassword,PDF_PERMISSION_NOCOPY));

  Result.DefaultPaperSize := psA4;
  Result.ScreenLogPixels  := ActScreenLogPixels;
  Result.EmbeddedTTF := true;
  Result.EmbeddedTTFIgnore.Text:= My_DEFAULT_FONTS;
  Result.EmbeddedWholeTTF := true;
  Result.Info.Author := CfgSettings.GetUserFullName; // Get user name
  Result.Info.CreationDate := Now;
  Result.Info.Creator := CreatorApp; // name of App
  Result.Info.Subject := Subject;

  Result.Info.Title := Title;
  if Filename <> '' then Result.Info.Title := Result.Info.Title+' '+FileName;
end;

If encryption is turned on, the properties shown by Adobe Acrobat change from readable strings to typical RC4-coded strings:
Title: 'Ł\ ²¾'
Author: '>3“ ñb ˛3¨°F já'
Subject: 'yRÈú`œ–çJ'

The question is: Is there a chance to encrypt the pdf in a way that document properties remain readable? Does someone know a solution or workaround for this?

Thanks for any help.

Wolfgang

Offline

Board footer

Powered by FluxBB