i want to generate barcode image using codeigniter for the first time.
im using this library from this url :
https://github.com/desta88/Codeigniter-Barcode-Generator-Zend-Library
i follow all the instructions. but i got error. it told me that zend lib doesnt exist.
Non-existent class: Zend
here is my library folder structure :
application
- libraries
- zend.php
- zend (folder)
- barcode (folder)
- barcode.php
- exeception.php
- loader.php
- validate.php
here is my controller :
public function set_barcode($code) {
//load library
$this->load->library('zend');
//load in folder Zend
$this->zend->load('Zend/Barcode');
//generate barcode
Zend_Barcode::render('code128', 'image', array('text'=>$code), array());
}
many thanks in advance.
ps :
im using codeigniter v 3.05
zend framework v 2.49
The file Zend.php in application/libraries declares the class like this.
class CI_Zend {
Change it to
class Zend {
Related
I am trying to display the SSRS report in a .Net Core 3.1 MVC application.
I tried to implement the approach mentioned in
https://alanjuden.com/2016/11/10/mvc-net-core-report-viewer/?unapproved=58532&moderation-hash=321d5350c96d2fcf83baa4c939bbdf53#comment-58532
public class ReportsController : AlanJuden.MvcReportViewer.ReportController
{
protected override ICredentials NetworkCredentials
{
get
{
//Custom Domain authentication (be sure to pull the info from a config file)
return new System.Net.NetworkCredential("username", "password");
//Default domain credentials (windows authentication)
//return System.Net.CredentialCache.DefaultNetworkCredentials;
}
}
protected override string ReportServerUrl
{
get
{
//You don't want to put the full API path here, just the path to the report server's ReportServer directory that it creates (you should be able to access this path from your browser:
return "https://YourReportServerUrl.com/ReportServer/ReportExecution2005.asmx";
}
}
public IActionResult ProcessReport()
{
var model = this.GetReportViewerModel(Request);
model.ReportPath = "reportPath";
return RedirectToAction("ReportViewer", model);
}}
but it is not working with the latest framework.
I am getting following error while running the project - Error screenshot
Any help is appreciated.
Thanks!
The same thing happened to me, in my case I needed to install the same package that tells you to install
Install-Package System.ServiceModel.Http -Version 4.1.0
or in the nuget look for the package System.ServiceModel.Http
I tried different workarounds with latest .NET Core including the one you mentioned from Alan Juden. However the easiest thing that worked for me is to create a plain .NET WebForms site using the Report Viewer control from Microsoft. It was still a lot of code but this is solid because the Report Viewer control has been around for many years.
In my case it is showing SSRS Report from Angular UI, but the same will work with MVC or any other Web UI because you will actually redirect/navigate to another url (WebForms aspx page).
More details here.
I've been using spipu/Html2Pdf version 5.2 in laravel 5.8 to generating PDF, and trying to set my own creator name on the PDF (by default the creator is Html2Pdf - TCPDF)
Is that any way to change it via Html2Pdf class (without modifying the vendor)? or am I allowed to do that?
The creator name comes from TCPDF package (A package Html2Pdf uses) and I think it can be changed with the following:
$html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
$html2pdf->pdf->setCreator('CREATOR NAME');
This question relates to an ASP.NET MVC WEP API, and Naudio
what I want
I was working prototype in WPF appliations when I use this code the wav file is converted to mp3
var retMs = new MemoryStream();
using (var ms = new MemoryStream(File.ReadAllBytes("sound.wav")))
using (var rdr = new WaveFileReader(ms))
using (var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, 128))
{
rdr.CopyTo(wtr);
}
return retMs.ToArray();
But when using this code in api project I am getting error like this
Unable to load DLL 'libmp3lame.dll': The specified module could not be
found.
I know libmp3lame is unmanged dll, the WPF project I just copy the dll to bin folder and everything works fine, but how can I achieve this in Web API project, I mean asp.net 5 project
Note
the above code is working expected in wpf project
Also now I am only supported in my API is dotnetframwork means windows only
I removed other platform dependencies
Update:
Created Issue in ASP.Net MVC Repo
I'm a little late to the party but I'll share this for posterity. NAudio can convert a WAVE to an MP3 without the unmanaged DLL to avoid this issue all together. The only snag is it has to write out to a file (which can then be read back in). Assuming you have a MemoryStream where you read all the bytes in (like you did):
using (var wfr = new WaveFileReader(ms))
{
MediaFoundationApi.Startup();
MediaFoundationEncoder.EncodeToMp3(wfr, #"C:\Temp\test.mp3", 48000);
MediaFoundationApi.Shutdown();
}
Sounds like an issue with getting the mapping to the module in the bin library path, check out the following as may help -
How to get bin folder in ASP.NET Core 1.0
MVC4 App "Unable to load DLL 'libmp3lame.32.dll'
I need to add the quite excellent PHPWord - https://github.com/PHPOffice/PHPWord to a Joomla 2.5 project.
I have added the PHPWord files to the plugins folder (might not be the correct choice) and have the following code
$phpWord = new \libraries\PhpOffice\PhpWord\PhpWord();
The class is not found as it is not autoloading. How would I load these classes in Joomla and it there a better folder than plugins that will will autoload?
I have added these lines
JLoader::discover('PhpWord', JPATH_LIBRARIES . '/PhpOffice/PhpWord/');
$phpWord = new PhpWord;
Inside the PhpWord folder is Phpword.php and autoloader.php, as well as several other scripts.
As said in the comment above in Using_own_library_in_your_extensions they explain how to import a library for Joomla 2.5 and Joomla 3.
Now assuming that the tutorial is correct and JLoader::discover is working I would say that the issue is that you have PHPWord in the plugin folder and with JLoader::discover you are searching in /libraries/PhpOffice/PhpWord/.
So
copy /PhpOffice/PhpWord/ in libraries
try to use again JLoader::discover('PhpWord', JPATH_LIBRARIES . '/PhpOffice/PhpWord/');
Reading the documentation of PhpWord I found that you can also directly require the library and use it in this way:
// be sure that the path match in your joomla
require_once 'libraries/PhpWord/Autoloader.php';
\PhpOffice\PhpWord\Autoloader::register();
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
I am developping a web application by using the ASP .NET MVC 3 framework.
I am using Windows XP Professional on my computer.
I have decided to execute my web application via my IIS 5.1 local server during the development.
First I have installed IIS 5.1.
Then I have created a virtual directory under the default web site for my web application.
Then I have executed the following command line :
aspnet_regiis -i
Then I have added the following extension mapping to my virtual directory :
Executable : C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
Extension : .*
Option "Check file existence" unchecked.
For information here is my RegisterRoutes method written in my Global.asax.cs file :
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Accueil", action = "Accueil", id = UrlParameter.Optional } // Default parameters
);
}
When I launch my web application via Visual Studio 2010 in debug mode then I can load one my view with success.
But I noticed that an image was not loaded.
Here is the img tag containing the image :
<img src="../../../Content/images/Valider_064.png" alt="Valider" />
Here is a piece of my web application folder tree :
ActivitesHtml5 [FOLDER] : Root of web application
Content [FOLDER]
images [FOLDER]
Valider_064.png [FILE]
Controller [FOLDER]
ConnexionController.cs [FILE] : Contains the action method to generate my view.
Views [FOLDER]
Connexion [FOLDER]
Connexion [FOLDER]
Connexion.cshtml [FILE] : Razor file of my view.
Does someone know why my image is not correctly loaded ?
How about using url helpers instead of hardcoding your urls:
<img src="#Url.Content("~/Content/images/Valider_064.png")" alt="Valider" />
Also I would totally recommend you to stay away from IIS 5.1 especially if your target deployment server for the application will be IIS 7.0+. Cassini or IIS Express are much better alternatives and are directly integrated into Visual Studio.