synopse / mORMot2

OpenSource RESTful ORM/SOA/MVC Framework for Delphi and FreePascal
https://synopse.info
Other
485 stars 122 forks source link

PDF/A validation failed (no OutputIntent for RGB) #265

Open tueddy opened 5 days ago

tueddy commented 5 days ago

Hi,

validation of a very simple PDF/A fails in Acrobat preflight and some online validators e.g. https://www.pdf2go.com/validate-pdfa or https://www.pdfforge.org/online/de/pdfa-validieren :

The validation for file Test.pdf against PDF/A-1B validation profile was not successful, your file broke the following rules:

  • DeviceRGB may be used only if the file has a PDF/A-1 OutputIntent that uses an RGB colour space

A minimal reproducable example:

procedure TForm2.Button1Click(Sender: TObject);
var
  PdfDocument: TPdfDocumentGDI;
  Bmp: TBitmap;
begin
  PdfDocument:= TPdfDocumentGDI.Create;
  try
    PdfDocument.PDFA:= pdfa1B;
    PdfDocument.AddPage;
    // add drawing
    PdfDocument.VclCanvas.Rectangle(200, 10, 300, 110);
    // add text
    PdfDocument.VclCanvas.TextOut(100, 100, 'PDF/A test');
    // add image
    Bmp:= TBitmap.Create(150, 150);
    try
      Bmp.Canvas.Brush.Color:= clBlue;
      Bmp.Canvas.Ellipse(10, 10, 140, 140);
      PdfDocument.VclCanvas.Draw(100, 200, Bmp);
    finally
      Bmp.Free;
    end;

    PdfDocument.SaveToFile('C:\Temp\Test.pdf');
  finally
    PdfDocument.Free;
  end;
end;

Something must be wrong with the generated OutputIntent, the RGB output condition does not seem to be recognized by the validator?