You are not logged in.
Pages: 1
Hello,
if I understand this post correctly, using TPdfDocumentGDI with ForceJPEGCompression and the VCLCanvas property should lead to JPEG images in the resulting PDF. Unfortunately that doesn't work for me.
My code basically looks like this:
PDF := TPdfDocumentGDI.Create(False, 0, true);
PDF.ForceJPEGCompression := 90;
PDF.NewDoc;
PDF.AddPage;
PrintCanvas := PDF.VCLCanvas;
x := TRect.Create(0, 0, Image.Width - 1 , Image.Height);
y := TRect.Create(0, 0, PDF.VCLCanvasSize.cx - 1, PDF.VCLCanvasSize.cy);
PrintCanvas.CopyMode := cmSrcCopy;
PrintCanvas.CopyRect(y, Image.Canvas, x);
PrintCanvas := nil;
if Assigned(PDF) then FreeAndNil(PDF);
In the resulting PDF file I do find the following part, when setting ForceJPEGCompression to 90:
<</Length 0/Type/XObject/Subtype/Image/ColorSpace/DeviceRGB/Width 0/Height 0/BitsPerComponent 8/Name/SynImg0/Filter/DCTDecode>>
stream
endstream
It seems that no image stream is saved to the PDF file? Any ideas what I am doing wrong?
Best regards,
Jan
Offline
For me this is fixed by a slight modification of SynPdf. See https://github.com/synopse/SynPDF/pull/39
Offline
Offline
Pages: 1