ASP.Net || iTextSharp in dotnet cannot use iTextAsian - asp.net

I am having trouble with iTextAsian which cause me done nothing but finding solution all this week, it would be great if I can have the solution here.
My situation is I have a project which is using iTextSharp for a while, I had two blocks of code as following, please note that both of them are worked for me
Block 1:
Private Function aFunc() as returnType
iTextSharp.text.io.StreamUtil.AddToResourceSearch(
System.Reflection.Assembly.Load("iTextAsian")
)
Dim font As Font = MyPDF.GetFont
End Function
Protected Friend Shared Function GetFont() As Font
Return New Font(
BaseFont.CreateFont(
"STSong-Light",
"UniGB-UCS2-H",
BaseFont.NOT_EMBEDDED
)
)
End Function
Block 2 (current)
Public Shared Function GetChineseFont() As iTextSharp.text.Font
iTextSharp.text.io.StreamUtil.AddToResourceSearch(
System.Reflection.Assembly.Load("iTextAsian")
)
Return New Font(
BaseFont.CreateFont(
"STSong-Light",
"UniGB-UCS2-H",
BaseFont.NOT_EMBEDDED
)
)
End Function
I am using iTextAsia2.1 and it used to work fine for me, but it start to pop me ""Font 'STSong-Light' with 'UniGB-UCS2-H' is not recognized."" exception on my development server since last week.
The weirdest thing is the version of my website between dev and production server are same, but this block of code worked only on production server, I am wondering whats the matter and I am afraid that one day this exception will appear on my production server.
Please suggest me some solution please.
Thanks for your time!

Are you taken update?
The error will come when some clash between older version and newer version or font missing etc. please check this link.
http://www.excindex.com/web/831818.html
http://www.csharpcode.info/ask-235324.html
http://itext-general.2136553.n4.nabble.com/Asian-font-not-recognized-after-update-td2991134.html
http://stderr.org/doc/libitext-java-doc/www/tutorial/ch09.html
Before you start anything, What I think, you just download your production all dll and put in your local development. Check wheather the issue solved

Sorry all, I finally figure it out, its because the following block should not contains in a Shared function
iTextSharp.text.io.StreamUtil.AddToResourceSearch(
System.Reflection.Assembly.Load("iTextAsian")
)
I now called this line in Application_Start of global.asax and the problem is solved, thanks for your time and suggestions!

Related

No Way to get the console handle (Dev-Pascal)

I've tried the simple program for my exercise but if i compiled, it turned give a message "No Way to get the console handle" (Dev-Pascal).
Here's my code:
program square;
uses crt;
var
side,circumference,broad:real;
begin
write('Input the side value of the square: ');
readln(side);
circumference := 4 * side;
broad := side * side;
writeln('The circumference value of the square = ', circumference);
writeln('The abroad value of the square = ', broad);
writeln();
write('Press any key...');
readkey();
end.
thank you for helping and teaching me
i would appreciate
Dev-pascal comes with a 10+ years old Free Pascal version. I really have no idea. Try to run the example on the cmdline to see if dev-pascal is the cause or something else. Temporarily disable security software might also be something to try.
I suppose, you've created a Window Skeleton project.
It has it's description: A Windows skeleton application (no window).
In this case you'll get this error though you code compiles (I've got this error too with your code).
Try to create Console Application project which has it's own description: A standard console-based (MS-DOS) application (Your code has compiled and the program worked as well).
P.S. Can't say what exactly happens -- couldn't find any documentation about errors in Dev-Pas (1.9.2).
My assumption is that skeleton program doesn't imply console window for execution program while console application does.
just close the project and then re-open the pascal source file (.pas). And maybe put "readln;" just before "END.".

Websphere & Tivoli: NPE while trying to create PDAuthorizationContext

I am getting the following error when I try to start my Application...
[java.lang.IllegalStateException: java.lang.NullPointerException^M
at com.tivoli.pd.jutil.kb$1.run(kb$1.java:41)^M
at java.security.AccessController.doPrivileged(AccessController.java:229
)^M
at com.tivoli.pd.jutil.kb.c(kb.java:141)^M
at com.tivoli.pd.jutil.kb.(kb.java:56)^M
at com.tivoli.pd.jutil.PDContext.(PDContext.java:76)^M
at com.tivoli.pd.jazn.PDAuthorizationContext.(PDAuthorizationConte
xt.java:66)^M
I double checked the config file was accessible and I could read it. The code I am using looks as follows...
aC = new PDAuthorizationContext(cFile);
Is there a way to get more information on what is causing the NPE?
More information!!!
After debuging a bit, it appears the issue comes from this code (they use progaurd so it is a little hard to be 100% confident)...
Certificate[] arrayOfCertificate1 = ((KeyStore)???).getCertificateChain("DefaultID");
//Throws Null pointer (presumably because array is null)
Certificate localCertificate1 = arrayOfCertificate1[0];
EVEN MORE INFO
This appears to be some kind of dependency conflict (guess), because if I just create a sample App using PDAuthorizationContext it works fine.
Problem was related to the PD.jar version that I was using. Although I thought I was using one version I was using another. This was because on version was registered in my WebSphere library (under build path in eclipse). Once the proper library was introduced everything worked.

Web Resource was not found

I've spent the last day trying to get a checkbox validator to work. I found some starting code on the 4GuysFromRolla website, however this was coded back in 2006 and doesn't play alongside updatepanels.
I've made changes and now it works. As I'd made quite a few changes I wanted to standardise it and use it alongside other utility classes, so I created a new class project and copied the code verbatim.
The problem is that the original works, but I get a WebResource not found error on my new class project.
The differences are: The original was a web application project:
my new project is simply a class library project.
The original assembly and namespace have changed.
Both contain a single class and a resource file (.js)
Both resource files are contained in the root directory
Both resource files are set to embed resource
I'm running out of ideas, and have exhausted the answers I've found on the web with no success.
Is there an issue with the fact that its a class library? Have I perhaps overlooked something else?
Its pretty difficult to see beyond those 2 questions because the project is so small and insignificant.
Here's the code that does work:
if (this.RenderUplevel && this.Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "skmValidators.skmValidators.js");
}
Here's the code that doesn't:
if (this.RenderUplevel && Page != null)
{
ScriptManager.RegisterClientScriptResource(Page, this.GetType(), "ValidationExtender.EvaluationFunctions.js");
}
Anyone give any ideas?
Thanks in advance.
The error turned out to be a mismatch between the dll's in the test page.

browseForOpenMultiple - crashing

I am trying to work with browseForOpenMultiple function inside Flex, sdk 3.5, I am trying to figure out a bug. The browseForOpenMultiple does not crash everytime, but it seems as though I can upload a file once, but when I go to upload a second file, it crashes when the browseForOpenMultiple function is called. Anyone have any ideas about possible causes?
Update:
private function browseForFiles():void
{
fileBrowser = new File();
fileBrowser.addEventListener(FileListEvent.SELECT_MULTIPLE, filesSelected);
fileBrowser.addEventListener(Event.CANCEL, fileSelectionCancelled);
fileBrowser.browseForOpenMultiple("Select Desired Media File(s)", [(mode == "Media")? MediaTypes.getFileFilter() : MediaTypes.getVideoFilter()]);
}
So the code in our array of file extensions was crashing when there were over 60 items listed in an array that gets converted into a string for the FileFilter. This may not be an Adobe limit, but I wanted to make mention that the crash is fixed, so that others who may be encountering issues with browseForOpenMultiple will know what the issue was for this problem. This is not code that I originally wrote, so I will check into it for more clues, but for the time being, too many array items being joined together into a string for FileFilter object caused the crash.
It could be how it's construct the File, without a real file reference.
Try something like this :
var fileBrowser = File.desktopDirectory

Firefox adding some data into simple storage

I am learning how to make firefox extensions and have gotten totally confused... so I thought I would start from the basics again.
Can you make me (or walk me through creating) a simple skeleton extension that saves "ryan" into sqlite storage, so that it is available even on the browser restart?
From there I think I can start modifying it to run all the different code that exists only in my head... and to answer my own questions :))
Thanks!
Ryan
This is even simpler if you use the Addon SDK.
var storage = require("simple-storage").storage;
if (storage.name) {
console.log (storage.name);
}
else {
console.log ("Storing!");
storage.name = "ryan";
}
This will output "Storing!" the first time it's run, and "ryan" subsequent times.

Resources