#1 Re: PDF Engine » Parts of EMF are strange printed to PDF » 2015-03-16 11:14:01

I'm using this workaround (which is still far from being perfect) but at least works for me:

  EMR_EXTSELECTCLIPRGN: begin
    E.fStrokeColor := -1;
    E.fFillColor := -1;
    E.fPenStyle := -1;
    E.fPenWidth := -1;
    E.fStrokeColor := -1;
    E.Canvas.Page.Font := nil ;
    E.Canvas.GRestore ;
    E.Canvas.GSave ;
    E.ExtSelectClipRgn(@PEMRExtSelectClipRgn(R)^.RgnData[0],PEMRExtSelectClipRgn(R)^.iMode);
  end ;
  EMR_INTERSECTCLIPRECT: begin
    E.fStrokeColor := -1;
    E.fFillColor := -1;
    E.fPenStyle := -1;
    E.fPenWidth := -1;
    E.fStrokeColor := -1;
    E.Canvas.Page.Font := nil ;

    E.Canvas.GRestore ;
    E.Canvas.GSave ;
    ClipRgn := e.IntersectClipRect(e.Canvas.BoxI(PEMRIntersectClipRect(r)^.rclClip,true),ClipRgn);
    with e.Canvas.BoxI(PEMRIntersectClipRect(r)^.rclClip,true) do
      e.Canvas.Rectangle(Left,Top,Width,Height);
    e.Canvas.Clip;
    e.Canvas.NewPath;
  end;


I also implemented:

procedure TPdfCanvas.Comment( text : String );
begin
  if FContents<>nil then
    FContents.Writer.Add('%' + text + #10);
end;

It is a pretty good help for debugging PDF output. I inject EMF sentences so I'm able to manually alter PDF file without guessing what was responsible for particular pdf sequence.

Board footer

Powered by FluxBB