I'm trying to print some of my document.
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
=============== =====
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ;
info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN);
::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED);
::SetBkMode(inf o.hdc, TRANSPARENT);
::SetWorldTrans form(info.hdc, (XFORM*) p_transform);
}
=============== ===== 5 1428
All my text output looks like shrink.
I mean all the characters are correctly positioned compare to each other, but it just occupies the top left quadrant.
"Lloyd Dupont" <net.galador@ld > wrote in message news:uD******** ******@TK2MSFTN GP15.phx.gbl...
I'm trying to print some of my document.
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
=============== =====
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ;
info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN);
::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED);
::SetBkMode(inf o.hdc, TRANSPARENT);
::SetWorldTrans form(info.hdc, (XFORM*) p_transform);
}
=============== =====
The Preview doesn't display text all :-(
And the printing just shrinking it ?!?.....
"Lloyd Dupont" <net.galador@ld > wrote in message news:uD******** ******@TK2MSFTN GP15.phx.gbl...
I'm trying to print some of my document.
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
=============== =====
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ;
info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN);
::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED);
::SetBkMode(inf o.hdc, TRANSPARENT);
::SetWorldTrans form(info.hdc, (XFORM*) p_transform);
}
=============== =====
I tried to multiply my world transform matrix by thes factor:
static int TextPrintScale( HDC& hdc)
{
HDC screenDc = GetDC(NULL);
int screenDpi = GetDeviceCaps(s creenDc, LOGPIXELSX);
ReleaseDC(NULL, screenDc);
int devDpi = GetDeviceCaps(h dc, LOGPIXELSX);
return devDpi / screenDpi;
}
the weird thing is, it work well if I use this integer division of devDpi / screenDpi.
But first I tryed to used a float factor by returning:
return ((float) devDpi) / screenDpi;
And this was clearly wrong, (the page was clearly scaled too much as if 3 was right but 300.0 / 96.0 was not).
I'm kind of confused about that, I would have expect the float division to be right.
Any thoughts?
Also whatever I do the System.Windows. Forms.PrintPrev iewDialog still display no text at all.... :-/
"Lloyd Dupont" <net.galador@ld > wrote in message news:uD******** ******@TK2MSFTN GP15.phx.gbl...
I'm trying to print some of my document.
The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something else?)
I will investigate that.....
Anyway if any of you had similar experience and could shed some light?
Here is how I initialize my HDC (Managed C++):
=============== =====
struct HDCInfo
{
HDC hdc;
// to be restored
HGDIOBJ font0;
HGDIOBJ brush0;
HGDIOBJ pen0;
XFORM transform0;
};
void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info)
{
array<float>^ matrix = g->Transform->Elements;
pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ;
info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT);
info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH);
info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN);
::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED);
::SetBkMode(inf o.hdc, TRANSPARENT);
::SetWorldTrans form(info.hdc, (XFORM*) p_transform);
}
=============== =====
Lloyd,
You might try cc'ing the folks in
microsoft.publi c.dotnet.framew ork.drawing. They may be able to help you.
Jason
Lloyd Dupont wrote: I tried to multiply my world transform matrix by thes factor: static int TextPrintScale( HDC& hdc) { HDC screenDc = GetDC(NULL); int screenDpi = GetDeviceCaps(s creenDc, LOGPIXELSX); ReleaseDC(NULL, screenDc); int devDpi = GetDeviceCaps(h dc, LOGPIXELSX); return devDpi / screenDpi; }
the weird thing is, it work well if I use this integer division of devDpi / screenDpi. But first I tryed to used a float factor by returning: return ((float) devDpi) / screenDpi;
And this was clearly wrong, (the page was clearly scaled too much as if 3 was right but 300.0 / 96.0 was not). I'm kind of confused about that, I would have expect the float division to be right. Any thoughts?
Also whatever I do the System.Windows. Forms.PrintPrev iewDialog still display no text at all.... :-/
"Lloyd Dupont" <net.galador@ ld <mailto:net.gal ador@ld>> wrote in message news:uD******** ******@TK2MSFTN GP15.phx.gbl... I'm trying to print some of my document. The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text.
Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something /else/?) I will investigate that.....
Anyway if any of you had similar experience and could shed some light? Here is how I initialize my HDC (Managed C++): =============== ===== struct HDCInfo { HDC hdc; // to be restored HGDIOBJ font0; HGDIOBJ brush0; HGDIOBJ pen0; XFORM transform0; }; void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info) { array<float>^ matrix = g->Transform->Elements; pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ; info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT); info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH); info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN); ::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED); ::SetBkMode(inf o.hdc, TRANSPARENT); ::SetWorldTrans form(info.hdc, (XFORM*) p_transform); } =============== =====
good idea Jason, thanks! ;-)
"Jason Newell" <no****@nospam. com> wrote in message
news:e%******** ********@TK2MSF TNGP10.phx.gbl. .. Lloyd,
You might try cc'ing the folks in microsoft.publi c.dotnet.framew ork.drawing. They may be able to help you.
Jason
Lloyd Dupont wrote: I tried to multiply my world transform matrix by thes factor: static int TextPrintScale( HDC& hdc) { HDC screenDc = GetDC(NULL); int screenDpi = GetDeviceCaps(s creenDc, LOGPIXELSX); ReleaseDC(NULL, screenDc); int devDpi = GetDeviceCaps(h dc, LOGPIXELSX); return devDpi / screenDpi; }
the weird thing is, it work well if I use this integer division of devDpi / screenDpi. But first I tryed to used a float factor by returning: return ((float) devDpi) / screenDpi; And this was clearly wrong, (the page was clearly scaled too much as if 3 was right but 300.0 / 96.0 was not). I'm kind of confused about that, I would have expect the float division to be right. Any thoughts? Also whatever I do the System.Windows. Forms.PrintPrev iewDialog still display no text at all.... :-/ "Lloyd Dupont" <net.galador@ ld <mailto:net.gal ador@ld>> wrote in message news:uD******** ******@TK2MSFTN GP15.phx.gbl... I'm trying to print some of my document. The problem is, the rendering of the document is not done through GDI+ at all but through plain old GDI, and I need it like that as I am using Uniscribe to layout text. Anyway, when printing the text is completely out of place, I wonder if it's due to incorrrect Dpi settings? (or something /else/?) I will investigate that..... Anyway if any of you had similar experience and could shed some light? Here is how I initialize my HDC (Managed C++): =============== ===== struct HDCInfo { HDC hdc; // to be restored HGDIOBJ font0; HGDIOBJ brush0; HGDIOBJ pen0; XFORM transform0; }; void NText::ScriptAn alysis::GetHDC( Graphics^ g, struct HDCInfo& info) { array<float>^ matrix = g->Transform->Elements; pin_ptr<float> p_transform = &matrix[0];
info.hdc = (HDC)(void*)g->GetHdc(true) ; info.font0 = ::GetCurrentObj ect(info.hdc, OBJ_FONT); info.brush0 = ::GetCurrentObj ect(info.hdc, OBJ_BRUSH); info.pen0 = ::GetCurrentObj ect(info.hdc, OBJ_PEN); ::GetWorldTrans form(info.hdc, &info.transform 0);
::SetGraphicsMo de(info.hdc, GM_ADVANCED); ::SetBkMode(inf o.hdc, TRANSPARENT); ::SetWorldTrans form(info.hdc, (XFORM*) p_transform); } =============== ===== This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris |
last post by:
Hello all,
I wish to automate printing of PDF documents in a C# application.
Is there an Adobe .net object? I tried to create a reference to the COM
Object Adobe Type Library, but I get error "Exception from HRESULT 0x80131019"
Thanks
Chris
|
by: slothboy |
last post by:
Hey guys,
I'm having a little trouble printing subforms. I've attached the
snippet of code that prints my form which contains various subforms.
It prints bounded controls on the subform just fine, but it does not
print unbounded controls. Any advice would be hugely appreciated.
I'm sure it is something extremely simple, but I'm a bit new to Access
2000. Thanks so much.
stDocName = Me.Name
|
by: Karthik |
last post by:
Well I am coding an application using C# for my company which requires
multiple printing of Crystal Report Docs & Word Docs, at a specific Printer
of the installed Printers in the network, at a specific tray and some more
settings too.
since I'm trying with the network printer I've installed a local driver
using the local port as suggested by one of the MS support site.
The definition of the Printer & Tray is happening from the code...
|
by: Tim |
last post by:
Hi,
I am creating my own method for printing. I am using PrintDocument and
cycling through the data and creating new pages as neccessary.
My question is, how can I know that total number of pages so that I can put
"Page 1 of 5" on the first page and also I would know when to draw the
report footer?
Can anyone offer any advice?
|
by: appearinggalaxy |
last post by:
Hi,
I am trying to churn out some statistical data from database and
print it out by using printdocument and printdialog, but I realised
that the alignment of the data is gone, for instance, I use "vbTab",
but seems like it does not take effect on preview screen.
I am vex on this issue and would like to ask for the advice from
anyone who knows how to develop a good reporting module by using .net
printdocument and printdialog.
| |
by: J Ames |
last post by:
I have an ASP.NET (VB) form that has two drop downs, a horizontal rule and a
button. The button invokes a stored procedure and several tables are
created on the page with data populated. I want to create a link to print
the page, but I don't want the drop downs or the button to print, only the
tables. How can this be done? I know how to use a CSS file to disallow the
entire page from being printed, but I don't know how to apply this to...
|
by: defcon8 |
last post by:
How can I print html documents in Python on Windows?
|
by: Burhan |
last post by:
Hello Group:
I am in the planning stages of an application that will be accessed
over the web, and one of the ideas is to print a barcode that is
generated when the user creates a record. The application is to track
paperwork/items and uses barcodes to easily identify which paper/item
belongs to which record.
Is there an easy way to generate barcodes using Python -- considering
the application will be printing to a printer at the...
|
by: Frank Rizzo |
last post by:
I am trying to print huge images (much bigger than target paper). I try
and use e.PageSettings.HardMarginX and e.PageSettings.HardMarginY in the
PrintDocument's PrintPage event to try and determine the maximum area
that I can print on. However, the edge of the image invariably gets cut
off, as if the HardMargin info is wrong. I posted the code below as I
can't understand what I am doing wrong. Is information in
e.PageSettings reliable?...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |