You are not logged in.
Hello!
I have a document in a JPEG file (grayscale 8bit). When I make a PDF of it I've got a terrible background, red instead of white.
That's what I do:
var
page: TPdfPage;
pdfImage: TPdfImage;
jpeg: SynGdiPlus.TJpegImage;
pdfDoc: TPDFDocument;
begin
pdfDoc := TPDFDocument.Create(false, 0, true, nil);
try
pdfDoc.Info.CreationDate := Now;
pdfDoc.DefaultPaperSize := psA4;
jpeg := SynGdiPlus.TJpegImage.Create;
try
jpeg.LoadFromFile(FileName);
pdfImage := TPdfImage.Create(APdfDocument, jpeg, true)
finally
jpeg.Free;
end;
page := APdfDocument.AddPage;
APdfDocument.AddXObject(AName, pdfImage);
APdfDocument.Canvas.DrawXObject(0, 0, page.PageWidth, page.PageHeight, AName);
pdfDoc.SaveToStream(AOutStream);
finally
pdfDoc.Free;
end;
end;
Please help me. Whether this is a bug or I do something wrong?
Offline
DrawXObject goes from bottom of page to up. So must be:
APdfDocument.Canvas.DrawXObject(0, page.PageHeight, page.PageWidth, page.PageHeight, AName);
Offline