#1 PDF Engine » VCLCanvas and ExtCreatePen » 2021-12-10 15:50:55

Dicki
Replies: 2

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');

#2 Re: PDF Engine » Error with PDF from Metafile » 2014-03-30 11:42:28

Hello user,
we have found the "error".
The external program written in Delphi generated metafile with the scalierung by:

  fMetafile := TMetafile.Create;
  fMetafile.MMWidth := 19000; // = 190mm * 100
  fMetafile.MMHeight := 30000; // = 300mm * 100
  fMetafileCanvas := TMetafileCanvas.CreateWithComment(fMetafile, 0, '1', '2');
  SetMapMode(fView_PLBP_MetafileCanvas.Handle, MM_HIMETRIC);

the Prgrammierer change the code as follows:

  fMetafile := TMetafile.Create;
  fMetafile.Width := 19000; // = 190mm * 100 = 19000 Pixel
  fMetafile.Height := 30000; // = 300mm * 100 = 30000 Pixel
  fMetafileCanvas := TMetafileCanvas.CreateWithComment(fMetafile, 0, '1', '2');
  //SetMapMode(fView_PLBP_MetafileCanvas.Handle, MM_HIMETRIC); //This line is omitted

With this change we can generate from the metafiles PDF files.
In the Metafiles also circle segments are included (90 °, etc.) but these are not shown in the PDF file.
We use this SynPdf revision 2014-03-02.

#3 PDF Engine » Error with PDF from Metafile » 2014-03-03 13:09:41

Dicki
Replies: 1

Hello,
I create a PDF file from Metafiles.
The export seems to work fine, but the test position is nocht Ok.
Why?
As an investment the EMF file, the PDF file from synPDF (ERROR!) and for comparison, the PDF file as pressure in ScanSoftPDF.

PROCEDURE TppPrint.PrintPDF;
VAR
   fDialogResult: boolean;
   fNamePDF: STRING;
   fIndex: integer;
   fPageMetafile: TMetafile;
   fPDF: TPdfDocumentGDI;
   fPDFPage:TPDFPage;
BEGIN
   fDialogResult := false;
   IF fViewPrint.fSaveDialogDs <> NIL THEN
   BEGIN
     //
   END
   ELSE IF fViewPrint.fSaveDialog <> NIL THEN
   BEGIN
     fViewPrint.fSaveDialog.FileName :=
       ChangeFileExt(fViewPrint.fPdfFileName, '.pdf');
     fViewPrint.fSaveDialog.Filter := 'Adobe PDF (*.pdf)|*.pdf';
     fViewPrint.fSaveDialog.DefaultExt := 'pdf';
     fDialogResult := fViewPrint.fSaveDialog.Execute;
     IF fDialogResult = true THEN
     BEGIN
       fNamePDF := fViewPrint.fSaveDialog.FileName;
     END;
   END;
   IF fDialogResult = true THEN
   BEGIN
     fPageMetafile := TMetafile.Create;
     TRY
       fPDF := TPdfDocumentGDI.Create(false,0,true,nil);
       TRY
         fPDF.Info.CreationDate := Now;
         fPDF.Info.Creator := 'DickSoft';
         fPDF.Info.Title := 'Titel?';
         // ...

         fPDF.PDFA1 := true;
         // ----

         fPDF.DefaultPageWidth := Trunc(72 * self.fViewPrint.fMetafileWidth100MM/2540);
         fPDF.DefaultPageHeight :=Trunc(72 * self.fViewPrint.fMetafileHeight100MM/2540);
         fPDF.UseMetaFileTextPositioning := tpExactTextCharacterPositining;
         // tpKerningFromAveragePosition
         // tpSetTextJustification
         // tpExactTextCharacterPositining

         fPDF.NewDoc;
         FOR fIndex := 1 TO fViewPrint.fMaxPage DO
         BEGIN
           fPageMetafile.Clear;
           fPageMetafile.LoadFromFile(fViewPrint.fPfadFileName +
             IntTostr(PageOffset + fIndex) + fViewPrint.fFileNameSuffix);
           fPDF.AddPage;
fPDF.VCLCanvas.StretchDraw(Rect(0,0,
Trunc(Screen.PixelsPerInch * self.fViewPrint.fMetafileWidth100MM/2540),
Trunc(Screen.PixelsPerInch * self.fViewPrint.fMetafileHeight100MM/2540)),
fPageMetafile
);
         END;
         fPDF.SaveToFile(fNamePDF);
       FINALLY
         fPDF.Free;
       END;
     FINALLY
       fPageMetafile.Free;
     END;
   END;
END;

https://ftp.wf-ib.de/filevista/link.ash … 940c9a.zipFiles and Code

#4 PDF Engine » synpdf for Delphi XE5 ? » 2014-01-23 19:22:34

Dicki
Replies: 1

Is there a version for Delphi XE5?
if so, where can I download the files?
or there is an installation package?

#5 Re: PDF Engine » Install SynPDF into XE2 (32bit) » 2012-11-28 18:23:23

It is a Delphi-Componet of myself (dsPrintView)

#6 Re: PDF Engine » Install SynPDF into XE2 (32bit) » 2012-11-28 16:56:57

Thanks for the link.
with these files I have this error message in the Unit "SynCommons.pas".
E.G. Line in 2555 with the message: E1025 language feature is not supported: 'Object'
and Lines 2928, 3094, 3628, 3782, 3808, 3889, 3978, 6612, 6613, 3288

#7 PDF Engine » Install SynPDF into XE2 (32bit) » 2012-11-28 10:42:42

Dicki
Replies: 5

Hello everyone,

I can not compiled under Delphi XE2.

The Error-Message is:

DCC Fehler] SynCommons.pas(49): E1025 Sprach-Feature wird nicht unterstützt: 'Object'

Thank you for help

Board footer

Powered by FluxBB