#1 2014-01-14 09:37:54

swestner
Member
Registered: 2011-07-11
Posts: 8

Convert TIFF to PDF/A-1b

Hello,

I use the following code to convert a bunch of TIFF-Files to PDF/A-1b.

uses
  SynPDF
  , SynGdiPlus
  ;

procedure TForm1.Button1Click(Sender: TObject);
var
  pdfDoc: TPdfDocument;
  pdfpage: TPdfpage;
  pdfImage: TPdfImage;
  tiffimage: TTIFFImage;
  i: integer;
begin
  pdfDoc := TPdfDocument.Create(False, 0, True, Nil);
  pdfDoc.Info.Author:='';
  pdfDoc.Info.Creator:='';
  pdfDoc.DefaultPaperSize:=psA4;
  pdfDoc.ForceJPEGCompression:=0;
  pdfDoc.CompressionMethod:=cmFlateDecode;

  tiffimage := TTIFFImage.Create;

  for i:=1 to 3 do begin
    tiffimage.LoadFromFile(IntToStr(i)+'.tif');
    pdfpage:=pdfDoc.AddPage;
    pdfpage.PageWidth:=Round(tiffimage.Width *0.73);
    pdfpage.PageHeight:=Round(tiffimage.Height * 0.73);
    pdfImage:=TPdfImage.Create(pdfDoc,tiffimage,true);

    pdfDoc.AddXObject('image'+AnsiString(IntToStr(i)), pdfimage);
    pdfDoc.Canvas.DrawXObject(0,0,pdfpage.PageWidth,pdfpage.PageHeight,'image'+AnsiString(IntToStr(i)));
  end;

  pdfDoc.SaveToFile('output.pdf');

  pdfDoc.Free;
end;

The code works fine and I get an PDF/A-1b but if I do a preflight-check with Adobe Acrobat to check the the PDF/A1-b compliance I get several errors:

The separator before 'endstream' must be an EOL. (4)
xmp:CreateDate :: Wrong value type. Expected type 'Date'.
xmp:ModifyDate :: Wrong value type. Expected type 'Date'.
The document does not conform to the requested standard.
The file format (header, trailer, objects, xref, streams) is corrupted.
The document's meta data is either missing or inconsistent or corrupt.

What must be done to produce a valid PDF/A?

Thanks

Stefan

Offline

#2 2014-07-11 13:57:49

lobokoch
Member
Registered: 2014-07-11
Posts: 6

Re: Convert TIFF to PDF/A-1b

Hi,
I have the same problem but with a metafile:
xPDF.AddPage;
xPDF.Canvas.RenderMetaFile(MyMeta);
I try to validate the generated PDF/A file at http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx
But the validator also shows the same problem that you mentioned.

Kind regards,
Márcio Koch

Offline

#3 2014-07-11 15:02:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,225
Website

Re: Convert TIFF to PDF/A-1b

We tried to fixed the reported problems.

See http://synopse.info/fossil/info/02e9461c6c0d39d

Thanks for the feedback!

Offline

#4 2014-07-14 11:19:38

lobokoch
Member
Registered: 2014-07-11
Posts: 6

Re: Convert TIFF to PDF/A-1b

Thanks, the fix solved the problem, now passed at the validator.

Offline

Board footer

Powered by FluxBB