#1 Yesterday 06:16:55

etwoss
Member
Registered: 2025-07-09
Posts: 2

ChatGPT gives non compiling results ,what is wrong?

var
  Pdf: TPdfDocumentGDI;
begin
  Pdf := TPdfDocumentGDI.Create;
  try
    Pdf.UserPassword := 'view123';   // Password to open PDF
    Pdf.OwnerPassword := 'edit456';  // Password to override restrictions
    Pdf.EncryptPDF := True;
    Pdf.EncryptionPermissions := [ppPrint, ppCopy]; // Permissions

    Pdf.AddPage;
    Pdf.VCLCanvas.TextOut(100, 100, 'Encrypted content');

    Pdf.SaveToFile('encrypted.pdf');
  finally
    Pdf.Free;
  end;

This part does not compile, why??

   Pdf.UserPassword := 'view123';   // Password to open PDF
    Pdf.OwnerPassword := 'edit456';  // Password to override restrictions
    Pdf.EncryptPDF := True;
    Pdf.EncryptionPermissions := [ppPrint, ppCopy]; // Permissions


Eric

Offline

#2 Yesterday 07:06:39

rvk
Member
Registered: 2022-04-14
Posts: 139

Re: ChatGPT gives non compiling results ,what is wrong?

etwoss wrote:

This part does not compile, why??

That's because ChatGPT is NOT a programmer and if it doesn't know something... it just makes stuff up (which often doesn't work).

If you want encryption search this forum for TPdfEncryption and check out the examples as to how it's done correctly.

Offline

Board footer

Powered by FluxBB