#1 PDF Engine » Stack overflow with encrypted pdfs » 2020-04-30 12:14:24

fs999
Replies: 0

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;

#2 Re: PDF Engine » Saving a PDF document twice » 2019-01-14 09:51:57

You could do it this way :

fPDF := TPdfDocumentGDI.Create;
{Create some PDF content}
fPDF.SaveToFile('file1.pdf');
CopyFile('file1.pdf', 'file2.pdf', false);

#3 Re: PDF Engine » Compression » 2018-02-14 10:34:45

Hello,

Reviving this old post.

I have found source code for CCITT and JBIG2 on Github : https://github.com/Artogn/llPDFLib

I don't know if this can help you...

kind regards,
Frederic

#4 PDF Engine » Compression » 2017-03-01 09:14:28

fs999
Replies: 2

Hello,

Is there a way to have a monochrome bitmap or the VCLCanvas compressed with CCITT G4 or JBIG2 ?

Kind regards
Frederic

#5 Re: PDF Engine » Problem validating PDF/A format » 2017-01-25 16:13:35

Hello,

I have installed latest version (2017-01-18) from GitHub.

I try to generate a PDF/A-1a file of 2 pages report from QuickReport 4 like this :

  Pdf := TPdfDocumentGDI.Create;
  Pdf.GeneratePDF15File := False;
  Pdf.PDFA1 := True;
  Pdf.Info.Title := PrintName;
  Pdf.Info.Author := UserName;
  Pdf.Info.Creator := CompanyName;
  try
    for i := 1 to QRPreview.QRPrinter.PageCount do
    begin
      aMeta := QRPreview.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, tpKerningFromAveragePosition);
      finally
        aMeta.Free;
      end;
    end;
    if SaveDialog.Execute then
      Pdf.SaveToFile(SaveDialog.FileName);
  finally
    Pdf.Free;
  end;

The report consists of two b&w 200dpi scanned images on two pages.

When trying to validate the file with PDF Tools Online (https://www.pdf-online.com/osa/validate.aspx).

I get this result :

File    Test.pdf
Compliance    pdfa-1a
Result    Document does not conform to PDF/A.
Details   
Validating file "Test.pdf" for conformance level pdfa-1a
The key Type is required but missing.
The document does not conform to the requested standard.
The document doesn't provide appropriate logical structure information.
Done.

#6 Re: GDI+ » GIF, TIF, PNG and JPG pictures TGraphic read/write via GDI+ » 2016-04-29 12:00:11

Hello,

Is there a way to support the Zip or deflate compression method with Tiff images ?

Kind regards
Frederic

#7 Re: PDF Engine » Rendering issues (text right align, box borders) » 2015-11-18 14:39:04

I have the same problem with one report from QuickReport (3.6.2 pro). check boxes are not displayed, some grid lines are missing and some header text is scrambled.
EmfExplorer displays the saved emf page correctly, with one exception : when GDI+ is enabled one grid is not correctly positioned.
This problem does not occure when saved with SynPdf...
I can send you the file by email if you want.

Kind regards,
Frederic

Board footer

Powered by FluxBB