You are not logged in.
Pages: 1
I would like to define a line style using "ExtCreatePen". Why can't I add this "VCLCanvas"?
Is this even possible?
Here is an excerpt of my code, i work with Delphi 10.4:
fWritePDF := TPdfDocumentGDI.Create(false, 0, true, NIL);
fWritePDFPage := fWritePDF.AddPage;
// ...
LType := '03B013';
// ----------
fPenWidth := StrToFloat(RightStr(LType, 3));
fPenWidth := Trunc(0.5 + Screen.PixelsPerInch * fPenWidth / PDF_MMPI);
fWritePDF.VCLCanvas.Pen.Width := Trunc(fPenWidth);
// ---------
fStyleNr := StrToInt(LeftStr(Trim(LType), 2));
IF (fStyleNr > 1) AND (fStyleNr <= 15) THEN
BEGIN
fWritePDF.VCLCanvas.Pen.Width := 1;
fWritePDF.VCLCanvas.Pen.Style := TPenStyle.psUserStyle;
// ----------
fPDF_LogBrush.lbStyle := BS_Solid;
fPDF_LogBrush.lbColor := fWritePDF.VCLCanvas.Pen.Color;
fPDF_LogBrush.lbHatch := 0;
// ----------
CASE fStyleNr OF
2:
BEGIN
// ...
end;
4:
BEGIN
// LONG DASHED DOTTED
// 24;3;0.5;3
SetLength(fPDF_Pen, 4);
fPDF_Pen[0] := Trunc(0.5 + fPenWidth * 24 * fScale);
fPDF_Pen[1] := Trunc(0.5 + fPenWidth * 4 * fScale);
fPDF_Pen[2] := Trunc(0.5 + fPenWidth * 0.5 * fScale);
fPDF_Pen[3] := Trunc(0.5 + fPenWidth * 4 * fScale);
END;
// ...
END;
// -----
fPDF_NewPen := ExtCreatePen( { PS_USERSTYLE or } PS_Dash OR
PS_GEOMETRIC OR PS_JOIN_ROUND OR PS_ENDCAP_ROUND, Trunc(fPenWidth),
fPDF_LogBrush, HIGH(fPDF_Pen) + 1, fPDF_Pen);
// -----
IF fPDF_NewPen <> 0 THEN
BEGIN
// ShowMessage('fPDF_NewPen <> 0');
fPDF_OldPen := SelectObject(fWritePDF.VCLCanvas.Pen.Handle,fPDF_NewPen);
END;
// ===>> fPDF_OldPen = 0 !!! ???
IF (fPDF_OldPen <> 0) THEN
BEGIN
// ShowMessage('fPDF_OldPen <> 0');
fWritePDF.VCLCanvas.Pen.Style := TPenStyle.psDash;
END;
// ================
// ...
fWritePDF.VCLCanvas.MoveTo(fXA, fYA);
fWritePDF.VCLCanvas.LineTo(fXE, fYE);
// ...
fWritePDF.SaveToFile(fSaveFileName); // +'.pdf');
Offline
Please follow the forum rules, and don't post such extensive code snippets in the forum itself.
My guess is that if it is not rendered, this is because the SynPdf VCL/EMF to PDF interpreter does not support this command.
Offline
I would like to define a line style using "ExtCreatePen". Why can't I add this "VCLCanvas"?
Is this even possible?
Hi Dicki, I have slight expanded the support for the ExtCreatePen, you can try my code PDFEngine Clipping Implementation + Output stream optimizations and see if it solves your problems.
Offline
Pages: 1