|
When I open my printPreviewDialog my Document shows fine in the dialog, but when i click on print it prints only the Headers of the document. Does anyone know what could be wrong?
|
|
|
|
|
please let me know a way to use adobe libraries in C# programes to accomplish conversion to pdf.
|
|
|
|
|
I've read that the Adobe libraries, even in their current version, are unwieldy and not very developer-friendly. There are several vendors that publish COM/ActiveX/.NET libraries for converting/creating PDF documents. I've used ActivePDF with success, and colleagues have used others equally successfully. Some are even advertised here on CP, if you hang around long enough.
|
|
|
|
|
yes, i too have used pdflib but i will have adobe acrobat installed, so my client doesnt prefer to buy other third party software. so i should use only adobe libraries. got any way out
|
|
|
|
|
I know there was a recent article somewhere... but I cannot remember where just now. Another article on www.west-wind.com dealt with this, however the code samples are in Visual FoxPro; the principals are the same, but you might go bald trying to re-work VFP into C#...
|
|
|
|
|
There is a tool called tallpdf I have used for convertion of pdf. This component is fully .NET compatible and the information is available in www.pdfzone.com/toolbox/TallPDF.html.
|
|
|
|
|
Many of the PDF converts to which John referred are royalty-free, meaning the client won't have to buy anything (unless you are writing this for a specific cient as part of a contract or something similar).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi..theres a software called ghostsript that can convert from doc to pdf thats a open source and its free..
thank you
|
|
|
|
|
I am using VisualStudio.NET 2002 with .NET Framework 1.0 Actually i am developing a program in which i have to use Browser Control. I have used it on a control which facilitate me in providing wizard. Actually it is a wizard control on which i have used WebBrowser Control. Now i have start it both bu using Debug and without debu it is alright. Now i have created a form in which i call this wizard. Now if i run this program without using debug it will run alright but if i run it with start using debug it will give me error that cannot instantiate Active X control. What can be the problem please guide me
ThanX in advance
Regards
INAM
Inam
|
|
|
|
|
How do I declare a class used for utility that I do not have instantiate everytime I want to call a method from it. I have tried static this and void that, but can not seem to get it write. I know the prof mentioned it in a class I attended, but stupid me I did not write ti down.
thanks
rod
bigmansoftware.com
|
|
|
|
|
Any class can have static methods. Just create a class (e.g. MyClass) and add static methods to it. For example, suppose you wanted a method that you'd use to strip characters off the end of a string. You might write something like:
public static string ShortenString(string s, int len)
{
if( s.Length <= len )
return "";
return s.Substring(0, s.Length - len);
} Then, you could call the method by writing:
...
string sNewString = MyClass.ShortenString(sOldString, 2); Notice that MyClass is never instantiated. (Internally, I believe a 'static' instance is created.)
Tom
|
|
|
|
|
Oops your right I was thinking of the case of static variables in the class which would be constructed even when calling a static method. It's too late I should be asleep.
|
|
|
|
|
Next version of C# has "static" classes, which means that they contain no constructors or instance members:
public static class BoogsUtils {
public static int ComputeStuff() {
...
}
}
|
|
|
|
|
boogs wrote:
which means that they contain no constructors
No instance constructors, that is. Static constructors are still allowed, which are guaranteed to run only once per AppDomain .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Consider the following code:
a) ...
string str = richTextBox1.Text;
bool b = richTextBox1.CanUndo;
...
b) ...
int nLength = richTextBox1.TextLength;
bool b = richTextBox1.CanUndo;
...
Both a) and b): CanUndo always returns false, regardless the text has been modified (run-time).
It seems that any call to the Text, TextLength... property will clear the undo buffer. Thus it makes difficult to implement a context menu (Undo, Cut, Copy, Paste, ...) for the RichTextBox control.
Is this a bug of the RichTextBox control, or does I miss something? Note that the TextBox control does not encounter this problem.
Thank you in advance.
|
|
|
|
|
Zembaliti wrote:
Both a) and b): CanUndo always returns false, regardless the text has been modified (run-time).
According to the documentation, the TextBoxBase.CanUndo property indicates whether or not you can undo the previous operation. In both of your instances, you are not performing operations directly on the RichTextBox , but accessing two of its properties so it should return false.
- Nick Parker My Blog
|
|
|
|
|
I think Zembaliti is assuming that there was something in the undo buffer before these calls. As it happens, this is an acknowledged bug in the RichTextBox control. Even if the RichTextBox has changed, the act of accessing the Text property or the TextLength property completely wipes out the Undo/Redo buffer.
To work around this, you have to use the Win32 API (e.g. EM_GETTEXTEX) to get text, circumventing the Text property. If you want the Text length, you have to send the EM_GETTEXTLENGTHEX message to the control. I derive a new control from RichTextBox and override these properties to make using RichTextBox easier in my code.
You can see an example of using EM_GETTEXTLENGTHEX for this purpose on a RichTextBox in my recent article here. A google search also confirms it.
|
|
|
|
|
I copy the file 'C:\Program Files\Common Files\Microsoft Shared\Office10\RICHED20.DLL' into the directory with the executable (bin\debug), and the issue does not happen any more.
So is this bug of .NET Framework Runtime or of the Windows RICHED20.DLL file?
|
|
|
|
|
Good question. I don't have time to investigate it now, but because you can't be sure of which RichTextBox control you will be working with on the client machine (e.g. Riched32.dll or Riched20.dll), I still recommend that you derive a new control from RichTextBox and override the problem methods. You could do something like this:
public override string Text
{
get{
return API.GetRichTextText(this.Handle);
}
set {
base.Text = value;
}
}
where you define API.GetRichTextText() as:
public static string GetRichTextText(IntPtr hwndRichTextControl)
{
GETTEXTEX lpGETTEXTEX = new GETTEXTEX();
// * 2 For double byte
lpGETTEXTEX.cb = (GetTextLength(hwndRichTextControl) + 1) * 2;
lpGETTEXTEX.flags = 0; // For default.
lpGETTEXTEX.codepage = 1200; // Unicode.
StringBuilder sText = new StringBuilder(lpGETTEXTEX.cb);
SendMessage(hwndRichTextControl, EM_GETTEXTEX, ref lpGETTEXTEX, sText);
return sText.ToString();
}
and
[StructLayout(LayoutKind.Sequential)]
public struct GETTEXTEX
{
public Int32 cb;
public Int32 flags;
public Int32 codepage;
public IntPtr lpDefaultChar;
public IntPtr lpUsedDefChar;
}
private const int WM_USER = 0x400;
private const int EM_GETTEXTEX = WM_USER + 94;
You can do something similar for TextLength, or just get the text and measure it.
Tom Clement
Apptero, Inc.
|
|
|
|
|
Thank you for your informative answer.
So all the ways turn into using Win32 API to rewrite code from scratch. I don't like using Win32 API, because it involves a lot of things, such as Marshal, Permission, unsafe...
It makes your code not reusable. If someday Microsoft rewrites their System.Windows.Forms.dll file and the USER32.DLL file disappears..., then you have to rewrite your code. You have to change every time Microsoft changes.
And when the 64-bit Windows is released in the future, I think that USER32.DLL will be replaced by USER64.DLL...
|
|
|
|
|
The problem is clear now. I have found the answer at:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;812943
I hope MS will release a patch for this issue soon.
Regards,
Zembaliti
|
|
|
|
|
Is it possible to run a C# .NET program on Linux or MacOS? I read something about compiling a Portable Executable file, but I know nothing about it.
|
|
|
|
|
There is a project [^]to port .NET Framework to Linux. I guess you should be able to run it on Mac OS X too. I don't think though they will ever port every class in .NET framework.
|
|
|
|
|
Mac OS has the full support of .NET. You can run not only C# in Mac OS but all the .NET compatible languages in it.
|
|
|
|
|
Leslu wrote:
Mac OS has the full support of .NET. You can run not only C# in Mac OS but all the .NET compatible languages in it.
This is not true. There is a reference implementation for BSD which is the OS the OS X is based, however it doesn't support enough of the framework to allow Windows C# apps to run on an Apple.
Even the linux Mono project, only currently supports a subset of the entire .NET framework.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|