Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow on encrypted pdf #35

Open
fs999 opened this issue Apr 28, 2020 · 0 comments
Open

Stack overflow on encrypted pdf #35

fs999 opened this issue Apr 28, 2020 · 0 comments

Comments

@fs999
Copy link

fs999 commented Apr 28, 2020

I have a stack overflow error when saving when I try to encrypt a pdf.
The error appears in TPdfRawText.InternalWriteTo

Here is my code :

        p := TMemoryStream.Create;
         Pdf := TPdfDocumentGDI.Create(false, 0, false, TPdfEncryption.New(elRC4_40, '1234', '1234',  [epPrinting]));
        Pdf.GeneratePDF15File := True;
        Pdf.PDFA1 := False;
        Pdf.Info.Title := 'Title';
        Pdf.Info.Author := 'Author';
        Pdf.Info.Creator := 'Creator';
        try
          for i := 1 to QuickReport.QRPrinter.PageCount do
          begin
            aMeta := QuickReport.QRPrinter.GetPage(i);
            try
              Pdf.DefaultPageWidth := MulDiv(aMeta.Width,72,Pdf.ScreenLogPixels);
              Pdf.DefaultPageHeight := MulDiv(aMeta.Height,72,Pdf.ScreenLogPixels);
              Pdf.AddPage;
              Pdf.Canvas.RenderMetaFile(aMeta,1,0,0,0, tpSetTextJustification,99,101,tcNeverClip);
            finally
              aMeta.Free;
            end;
          end;
          Pdf.SaveToStream(p);     <<--- Error appears here
        finally
          FreeAndNil(Pdf);
          FreeAndNil(p);
        end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant