<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Text drucken unter Angabe der Position]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>durch die Suche habe ich nicht gefunden, was ich brauche, oder ich habe es übersehen.<br />
Ich möchte einen Text drucken und dabei angeben, dass dieser z.B. 25mm vom oberen Rand und 30mm vom linken Rand gedruckt wird - und zwar in der</p>
<p>Schriftgröße von 12 in der Schriftart Times New Roman. Das Problem dabei ist allerdings die Umrechnung auf die jeweilige Auflösung, usw...</p>
<p>Vielleicht hat ja jemand eine Idee oder einen guten Link.</p>
<p>Hier ist meine kleine Testfunktion:</p>
<pre><code class="language-cpp">struct tPrint
{
  PRINTDLG pd; 
  DOCINFO di;
  HWND hwndPrint; 
  int iAnzKopien;
  int iFromPage;
  int iToPage;
  string sSpoolname;
};

  ZeroMemory(&amp;MyPrint.pd, sizeof(MyPrint.pd));
  MyPrint.pd.lStructSize = sizeof(MyPrint.pd);
  MyPrint.pd.hwndOwner   = MyPrint.hwndPrint;
  MyPrint.pd.hDevMode    = NULL;     // Don't forget to free or store hDevMode
  MyPrint.pd.hDevNames   = NULL;     // Don't forget to free or store hDevNames
  MyPrint.pd.Flags       = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC
                 | PD_ALLPAGES | PD_HIDEPRINTTOFILE | PD_NOSELECTION | PD_PRINTSETUP | !PD_NONETWORKBUTTON;
  MyPrint.pd.nCopies     = MyPrint.iAnzKopien;
  MyPrint.pd.nFromPage   = MyPrint.iFromPage;
  MyPrint.pd.nToPage     = MyPrint.iToPage;
  MyPrint.pd.nMinPage    = 1;
  MyPrint.pd.nMaxPage    = MyPrint.iToPage;
  pd.hInstance = MyPrint.hInst;

  if (PrintDlg(&amp;MyPrint.pd)==TRUE) 
  {
    memset(&amp;MyPrint.di, 0, sizeof(DOCINFO));
    MyPrint.di.cbSize	= sizeof(DOCINFO);
    MyPrint.di.lpszDocName	= MyPrint.sSpoolname.c_str();
    MyPrint.di.lpszOutput = (LPTSTR) NULL;
    MyPrint.di.fwType = 0;

    StartDoc(MyPrint.pd.hDC, &amp;MyPrint.di);
    StartPage(MyPrint.pd.hDC);

    //DRUCKEN
    TextOut(MyPrint.pd.hDC, x, y, &quot;test&quot;, 4);

    EndPage(MyPrint.pd.hDC);
    EndDoc(MyPrint.pd.hDC);  // Dokument wird geschlossen
    DeleteDC(MyPrint.pd.hDC);

    if (MyPrint.pd.hDevMode != NULL) GlobalFree(MyPrint.pd.hDevMode);
    if (MyPrint.pd.hDevNames != NULL) GlobalFree(MyPrint.pd.hDevNames);

  }
</code></pre>
<p>x/y sollten dann die Millimeter-Angaben sein, die es auf die verschiedenen Druckerauflösungen umzurechnen gilt. Aber ich weiß nicht, wie.</p>
<p>Danke schon einmal.<br />
Steffen</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/113031/text-drucken-unter-angabe-der-position</link><generator>RSS for Node</generator><lastBuildDate>Wed, 01 Jul 2026 17:44:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/113031.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Jun 2005 19:31:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Text drucken unter Angabe der Position on Sat, 18 Jun 2005 19:31:23 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>durch die Suche habe ich nicht gefunden, was ich brauche, oder ich habe es übersehen.<br />
Ich möchte einen Text drucken und dabei angeben, dass dieser z.B. 25mm vom oberen Rand und 30mm vom linken Rand gedruckt wird - und zwar in der</p>
<p>Schriftgröße von 12 in der Schriftart Times New Roman. Das Problem dabei ist allerdings die Umrechnung auf die jeweilige Auflösung, usw...</p>
<p>Vielleicht hat ja jemand eine Idee oder einen guten Link.</p>
<p>Hier ist meine kleine Testfunktion:</p>
<pre><code class="language-cpp">struct tPrint
{
  PRINTDLG pd; 
  DOCINFO di;
  HWND hwndPrint; 
  int iAnzKopien;
  int iFromPage;
  int iToPage;
  string sSpoolname;
};

  ZeroMemory(&amp;MyPrint.pd, sizeof(MyPrint.pd));
  MyPrint.pd.lStructSize = sizeof(MyPrint.pd);
  MyPrint.pd.hwndOwner   = MyPrint.hwndPrint;
  MyPrint.pd.hDevMode    = NULL;     // Don't forget to free or store hDevMode
  MyPrint.pd.hDevNames   = NULL;     // Don't forget to free or store hDevNames
  MyPrint.pd.Flags       = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC
                 | PD_ALLPAGES | PD_HIDEPRINTTOFILE | PD_NOSELECTION | PD_PRINTSETUP | !PD_NONETWORKBUTTON;
  MyPrint.pd.nCopies     = MyPrint.iAnzKopien;
  MyPrint.pd.nFromPage   = MyPrint.iFromPage;
  MyPrint.pd.nToPage     = MyPrint.iToPage;
  MyPrint.pd.nMinPage    = 1;
  MyPrint.pd.nMaxPage    = MyPrint.iToPage;
  pd.hInstance = MyPrint.hInst;

  if (PrintDlg(&amp;MyPrint.pd)==TRUE) 
  {
    memset(&amp;MyPrint.di, 0, sizeof(DOCINFO));
    MyPrint.di.cbSize	= sizeof(DOCINFO);
    MyPrint.di.lpszDocName	= MyPrint.sSpoolname.c_str();
    MyPrint.di.lpszOutput = (LPTSTR) NULL;
    MyPrint.di.fwType = 0;

    StartDoc(MyPrint.pd.hDC, &amp;MyPrint.di);
    StartPage(MyPrint.pd.hDC);

    //DRUCKEN
    TextOut(MyPrint.pd.hDC, x, y, &quot;test&quot;, 4);

    EndPage(MyPrint.pd.hDC);
    EndDoc(MyPrint.pd.hDC);  // Dokument wird geschlossen
    DeleteDC(MyPrint.pd.hDC);

    if (MyPrint.pd.hDevMode != NULL) GlobalFree(MyPrint.pd.hDevMode);
    if (MyPrint.pd.hDevNames != NULL) GlobalFree(MyPrint.pd.hDevNames);

  }
</code></pre>
<p>x/y sollten dann die Millimeter-Angaben sein, die es auf die verschiedenen Druckerauflösungen umzurechnen gilt. Aber ich weiß nicht, wie.</p>
<p>Danke schon einmal.<br />
Steffen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/812087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/812087</guid><dc:creator><![CDATA[gs_zk_sed]]></dc:creator><pubDate>Sat, 18 Jun 2005 19:31:23 GMT</pubDate></item></channel></rss>