- int leftMargin = 20;
- int topMargin = 40;
-
-/* You might use THIS code to set the printer DC to ROUGHLY reflect
- * the screen text size. This page also draws lines of actual length 5cm
- * on the page.
- */
- // Get the logical pixels per inch of screen and printer
- int ppiScreenX, ppiScreenY;
- GetPPIScreen(&ppiScreenX, &ppiScreenY);
- int ppiPrinterX, ppiPrinterY;
- GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);
-
- // Here we obtain internal cell representation of HTML document:
- wxHtmlContainerCell *cell = html -> GetInternalRepresentation();
-
- // Now we have to check in case our real page size is reduced
- // (e.g. because we're drawing to a print preview memory DC)
- int pageWidth, pageHeight;
- int w, h;
- dc->GetSize(&w, &h);
- GetPageSizePixels(&pageWidth, &pageHeight);
-
- // Now we must scale it somehow. The best would be to suppose that html window
- // width is equal to page width:
-
- float scale = (float)((float)(pageWidth - 0 * leftMargin)/((float)cell -> GetMaxLineWidth() + 2 * leftMargin));
-
- // If printer pageWidth == current DC width, then this doesn't
- // change. But w might be the preview bitmap width, so scale down.
- float overallScale = scale * (float)(w/(float)pageWidth);
- dc->SetUserScale(overallScale, overallScale);
-
- // Calculate conversion factor for converting millimetres into
- // logical units.
- // There are approx. 25.1 mm to the inch. There are ppi
- // device units to the inch. Therefore 1 mm corresponds to
- // ppi/25.1 device units. We also divide by the
- // screen-to-printer scaling factor, because we need to
- // unscale to pass logical units to DrawLine.
-
- dc->SetBackgroundMode(wxTRANSPARENT);
-
- // TESTING
-
- int pageWidthMM, pageHeightMM;
- GetPageSizeMM(&pageWidthMM, &pageHeightMM);
-
-
- // This is all the printing :
- cell -> Draw(*dc, leftMargin, topMargin, 0, cell -> GetHeight());
+ wxFileDialog dialog(this, "Open HTML page", "", "", "*.htm", 0);
+
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ m_Name = dialog.GetPath();
+ m_Html -> LoadPage(m_Name);
+ m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)<hr>", wxPAGE_ALL);
+ }