I am getting Error while displaying bitmap file in my application.
code:
Bitmap logoBitmap = Bitmap.getBitmapResource("res/icon.png");
BitmapField bitmapField1 = new BitmapField(logoBitmap, Field.FIELD_HCENTER);
add(bitmapField1);
Getting error in console tab.
Error: Fridg:couldnot find res/icon.png.
I am using Eclipse with Blackberry Simulator 9700.
I have added the folder and images and it is displaying in the tree of Eclipse.
The solution is to remove "res/" from source string, because it uses res as a source folder.
Related
I am using following code to generate pdf from crystal report in ASP.NET MVC platform
[HttpGet]
public ActionResult ClassCard()
{
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Reports"), "ClassCard.rpt"));
rd.SetParameterValue("ClassName", "Kandy");
rd.SetParameterValue("Type", "Group Theory");
rd.SetParameterValue("year", "2016");
rd.SetParameterValue("Student", "KDG0012");
rd.SetDatabaseLogon("DB_74931_rmsecon_user", "snb123");
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
return File(stream, "application/pdf", "EverestList11.pdf");
}
catch (Exception ex)
{
throw ex;
}
}
this give me pdf as below
but as you see the barcode is shrinked ,how im solve this problem in ASP.NET MVC enviroment
i saw most people say add registy key ,but i cannot do this coz this is asp.net mvc web application and im going host this app on sheared server
if im Add below regiter keys the problem will solve only for if im generate crystal report in local desktop app
The problem is that the crystal reports runtime has or had a well known issue that fonts shrink when reports are exported to pdf.
As you noted one (undesirable) option is to modify registry keys as discussed here and here. Another is to compensate by sizing your fonts appropriately to allow for the shrinkage.
I opted for upgrading to Crystal reports for visual studio version 13 which supports dynamic image urls but more importantly I stopped using fonts in favour of a barcode imaging libraries.
I had faced the similar issue of shrinking of the font while exporting the file to PDF, this is actually the default behavior while export. In order to maintain the original font and behavior, you can check the following answers where few registry changes are suggested.
Font Size Problem Crystal Report
Font Issue Details in Crystal Report
I am creating an app for IOS, I opne the theme res on the editor, add a new GUI element, and when i try to add a Web View, nothing happened, the other components like maps or similar can be added. Only happen with the Web View
There is other way??
Ok I find the way to do it on code
protected void beforeWebcams(Form f) {
WebBrowser browser=new WebBrowser();
f.setLayout(new BorderLayout());
f.addComponent(BorderLayout.CENTER, browser);
}
now I will open a new question, i need to display an HTML code inside this webbrowser
Here's the top chunk of the code:
import java.util.* ;
//Build an ArrayList to hold all of the words that we get from the imported tweets
ArrayList<String> words = new ArrayList();
void setup() {
//Set the size of the stage, and the background to black.
size(800,800);
background(0);
smooth();
frameRate(5);
//Credentials
ConfigurationBuilder cb = new ConfigurationBuilder();
I'm trying to do something similar to Jer Thorp's tutorial: http://blog.blprnt.com/blog/blprnt/quick-tutorial-twitter-processing
I keep getting an error though: Cannot find a class or type named "ConfigurationBuilder"
I've tried to import stuff and keep getting errors when I try to drag and drop files- any suggestions?
You should be able to just drag the library .jar file onto the Processing editor. Make sure you get the correct .jar file, which you can check by either examining it as an archive file, or using the jar tf command.
You could also import the library using the Sketch -> Import Library menu. If the library isn't already installed, then you'll have to manually install it using the steps outlined here: http://wiki.processing.org/w/How_to_Install_a_Contributed_Library
I have created a swf that include text TLF.
After that I have loaded it in an flex mobile application.
At the beginning I had lot of problems to load it.
1- First because I used Loader and the project was created with Flash Profesional. The best way is load it with ProLoader of flash library included in Flash Professional.
2- One time I finally loaded and tried it in the simulator on desktop I tried it in my iPad in Debug and fast compilation mode. I had the next error:
Error #2100: The ByteArray parameter in Loader.loadBytes() must have
length greater than 0.
I fixed it compiling in FLA the swf with the option in publish settings library "combined in code". Great! TLF in iPad works! In iOS works!
3- But when I built a release of the same code (that works previously on debug in a device), when I open it I only see images. Not text. Why works on debug and not on release??
Do you know what I forgot?
Thanks a lot in advance.
EDIT TO ADD SOME CODE
I embed the swfs and loads them in a item renderer. The list has a dataprovider of ids. And I load in each item renderer the swf corresponding with the id.
[Embed(source="/bin/histologia.swf")]
public const PAG_01:Class;
[Embed(source="/bin/histologia.swf")]
public const PAG_02:Class;
public function set data( value:Object ):void {
...
var pagAsset:Class = pagesAssets.assets[value];
var pag:MovieClip = new pagAsset();
var SWFClass:ByteArray = pag.movieClipData;
var ldrContext:LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain));
ldrContext.allowLoadBytesCodeExecution = true;
currentLoader.loadBytes(SWFClass, ldrContext);
¿loadBytes implies runtime code? =(
I read this in an Adobe article:
If do you use TLF text, I merged the code, the library of TLF into the swf, since iOS does not load RSLs at runtime.
What am I doing but?? How can I embed, and use it?
I think this answer would help me but I'm not sure
UPDATE 2
I have changed the code. Used the swf merge from #Jeff Ward but the result is the same. The swf is loaded but the TLF text is not shown.
var pagAsset:Class = pagesAssets.assets[value];
var pag:MovieClip = new pagAsset();
addChild(pag);
Why??
I am using ABCPDF to print a PDF file to a local printer via EMF file. I've based this very closely on ABC PDF's sample "ABCPDFView" project. My application worked fine on my Windows 7 and Windows XP dev boxes, but when I moved to a Windows 2003 test box, simple embedded fonts (like Times New Roman 12) rendered completely wrong (wrong spot, and short and squat, almost like the DPI's were crazily wrong).
Note that I've hardcoded the DPI to 240 here b/c I'm using a weird mainframe print driver that forces 240x240. I can discount that driver as the culprit as, if I save the EMF file locally during print, it shows the same layout problems. If I render to PNG or TIFF files, this looks just fine on all my servers using this same code (put .png in place of .emf). Finally, if I use the ABCPDFView project to manually add in a random text box to my PDF, that text also renders wrong in the EMF file. (Side note, if I print the PDF using Acrobat, the text renders just fine)
Update: I left out a useful point for anyone else having this problem. I can work around the problem by setting RenderTextAsText to "0" (see code below). This forces ABCPDF to render the text as polygons and makes the problem go away. This isn't a great solution though, as it greatly increases the size of my EMF files, and those polygons don't render nearly as cleanly in my final print document.
Anyone have any thoughts on the causes of this weird font problem?
private void DoPrintPage(object sender, PrintPageEventArgs e)
{
using (Graphics g = e.Graphics)
{
//... omitted code to determine the rect, used straight from ABC PDF sample
mDoc.Rendering.DotsPerInch = 240 ;
mDoc.Rendering.ColorSpace = "RGB";
mDoc.Rendering.BitsPerChannel = 8;
mDoc.SetInfo(0, "RenderTextAsText", "0");//the magic is right here
byte[] theData = mDoc.Rendering.GetData(".emf");
using (MemoryStream theStream = new MemoryStream(theData))
{
using (Metafile theEMF = new Metafile(theStream))
{
g.DrawImage(theEMF, theRect);
}
}
//... omitted code to move to the next page
}
Try upgrading to the new version of abcpdf 8, it has its own rendering engine based on Gecko and so you can bypass issues like this when abcpdf is using the inbuilt server version of IE for rendering.
I was originally RDPing in with 1920x1080 resolution, by switching to 1024x768 res for RDP, the problem went away. My main program runs as a service, and starting this service from an RDP session w/ 1024x768 fixes it.
I have an email out w/ ABC PDF to see if they can explain this and offer a more elegant solution, but for now this works.
Please note that this is ABC PDF 7, I have no idea if this issue applies to other versions.
Update: ABC PDF support confirmed that its possible the service is caching the display resolution from the person that started the process. They confirmed that they've seen some other weird issues with Remote Desktop and encouraged me to use this 1024x768 workaround and/or start the service remotely.