View Issue Details

IDProjectCategoryView StatusLast Update
0037912FPCPackagespublic2020-10-21 08:07
ReporterRuben Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Summary0037912: FCL-PDF images not displayed correctly
DescriptionImages are not rendered correctly
Steps To Reproducefunction Timage2PDF.convert(bitmap:Tstream): TMemoryStream;
var PDF:TPDFDocument;
    PDFopts:TPDFOptions;
    P:TPDFpage;
    S:TPDFsection;
    IDX,W,H:integer;
    TS:TMemoryStream;
    UnitOfMeasure: TPDFUnitOfMeasure;
begin
  PDF:=TPDFDocument.create(nil);
  PDF.infos.Title:='test';
  PDFopts:=[poPageOriginAtTop];
  PDF.StartDocument;
  S:=PDF.Sections.AddSection;
  P:=PDF.Pages.AddPage;
  P.PaperType:= ptA4 ;
  P.UnitOfMeasure:=uomPixels;
  //IDX:=PDF.images.AddFromFile('qr.bmp');
  IDX:=PDF.images.Addfromstream(bitmap, TFPReaderBMP, false);
  W:=PDF.Images[IDX].Width;
  H:=PDF.Images[IDX].Height;
  P.DrawImageRawSize(0,P.GetPaperHeight - H,W,H,IDX);
  S.Addpage(P);
  TS:=MemoryStream.create;
  PDF.SaveToStream(TS);
  Result:=TS;
End
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Ruben

2020-10-12 00:03

reporter  

download (12).pdf (4,196 bytes)

Maxim Ganetsky

2020-10-21 02:09

reporter   ~0126437

FCL-PDF belongs to FPC project. Moving.

Anton Kavalenka

2020-10-21 08:07

reporter   ~0126438

1st - there is no complete code example
2nd - the PDF document creation initialized in such a manner:

D:=TPdfDocument.Create(nil);
D.Infos.ApplicationName := ApplicationName;
D.Infos.CreationDate := Now;
D.Infos.KeyWords:='some keywords';

D.Options := [poPageOriginAtTop{,poSubsetFont},poCompressFonts,poCompressImages,poUseImageTransparency,poUTF16Info];

PDF Options is a property of PDF document, but in proposed by Reporter code snipped they are simply not used.

Issue History

Date Modified Username Field Change
2020-10-12 00:03 Ruben New Issue
2020-10-12 00:03 Ruben File Added: download (12).pdf
2020-10-21 02:09 Maxim Ganetsky Summary Fcl-pfd images not displayed correctly => FCL-PDF images not displayed correctly
2020-10-21 02:09 Maxim Ganetsky Steps to Reproduce Updated View Revisions
2020-10-21 02:09 Maxim Ganetsky LazTarget => -
2020-10-21 02:09 Maxim Ganetsky Note Added: 0126437
2020-10-21 02:10 Maxim Ganetsky Project Packages => FPC
2020-10-21 08:07 Anton Kavalenka Note Added: 0126438