.NET news » Search results
Search results for query "images" (40):
Filling in PDF Forms with ASP.NET and iTextSharp
The Portable Document Format (PDF) is a popular file format for documents. PDF files are a popular document format for two primary reasons: first, because the PDF standard is an open standard, there are many vendors that provide PDF readers across virtually all operating systems, and many proprietary programs, such as Microsoft Word, include a "Save as PDF" option. Consequently, PDFs server as a sort of common currency of exchange. A person writing a document using Microsoft Word for Windows can save the document as a PDF, which can then be read by others whether or not they are using Windows and whether or not they have Microsoft Word installed. Second, PDF files are self-contained. Each PDF file includes its complete text, fonts, images, input fields, and other content. This means that even complicated documents with many images, an intricate layout, and with user interface elements like textboxes and checkboxes can be encapsulated in a single PDF file.
Due to their ubiquity and layout capabilities, it's not uncommon for a websites to use PDF technology. For example, when purchasing goods at an online store you may be offered the ability to download an invoice as a PDF file. PDFs also support form fields, which are user interface elements like textboxes, checkboxes, comboboxes, and the like. These form fields can be entered by a user viewing the PDF or, with a bit of code, they can be entered programmatically.
This article is the first in a multi-part series that examines how to programmatically work with PDF files from an ASP.NET application using iTextSharp, a .NET open source library for PDF generation. This installment shows how to use iTextSharp to open an existing PDF document with form fields, fill those form fields with user-supplied values, and then save the combined output to a new PDF file.
Color Matrix Image Drawing Effects
Gracefully Responding to Unhandled Exceptions - Displaying User-Friendly Error Pages
In .NET applications, an illegal operation - an invalid cast, attempting to reference a null value, trying to connect to a database
that's been taken offline, and so on - raises an exception. Exceptions can be caught and handled directly in code
through the use of Try / Catch blocks. For ASP.NET applications, if the exception is
not handled in code, it bubbles up to the ASP.NET runtime, which raises an HttpUnhandledException.
By default, unhandled exceptions result in a page that displays the text, "Runtime Error" with instructions for developers on how to display exception details
(see the screen shot to the right). This "Runtime Error" error page is what is seen by external visitors; if you visit your site through
localhost and an unhandled exception occurs, the default error page includes the type and details of the exception thrown.
End users will no doubt find the "Runtime Error" page to be intimidating and confusing - do you think the average computer user knows what "Runtime" means? All the user knows is that something went horribly wrong. They might fear that their data or progress has been lost and that they are responsible for the error. Ironically, the person who does care that an unhandled exception has occurred - the developer - is left out of the loop unless the end user takes the time to email the developer the details of the error (what page it happened on, the steps the user had performed that caused the error, and so on)..
Creating Charts with the Google Chart API
This article looks at how to use the Google Chart API to create charts. The Google Chart API is a
free service from Google that enables web developers to generate chart images on the fly by creating an <img> element with a
src attribute that points to a URL that includes the chart data, labels, and other information in the querystring. Read on to learn how to use the Google Chart API in your ASP.NET website!
Accessing Images On Flickr From An ASP.NET Website Using The Flickr.Net Library
This article explores the open source Flickr API library called Flickr.Net, which was created by Sam Judson and was used in my aforementioned project. Specifically, well look at how to create an ASP.NET website that displays a smattering of randomly selected pictures from a particular Flickr user, along with how to show a specific pictures comments (if any exist). And the complete code in both Visual Basic and C# is available for download at the end of this article.
Looking at Themes and Skins
View Looking at Themes and Skins
Creating PDF Documents with ASP.NET and iTextSharp
The Portable Document Format (PDF) is a popular file format for documents. Due to their ubiquity and layout capabilities, it's not uncommon for a websites to use PDF technology. For example, an eCommerce store may offer a "printable receipt" option that, when selected, displays a PDF file within the browser. Last week's article, Filling in PDF Forms with ASP.NET and iTextSharp, looked at how to work with a special kind of PDF document, namely one that has one or more fields defined. A PDF document can contain various types of user interface elements, which are referred to as fields. For instance, there is a text field, a checkbox field, a combobox field, and more. Typically, the person viewing the PDF on her computer interacts with the document's fields; however, it is possible to enumerate and fill a PDF's fields programmatically, as we saw in last week's article.
This article continues our investigation into iTextSharp, a .NET open source library for PDF generation, showing how to use iTextSharp to create PDF documents from scratch. We start with an example of how to programmatically define and piece together paragraphs, tables, and images into a single PDF file. Following that, we explore how to use iTextSharp's built-in capabilities to convert HTML into PDF. Read on to learn more!
Using Microsoft's Chart Controls In An ASP.NET Application: Exporting Charts
The Chart Web control makes it easy to display a chart in an ASP.NET web page - simply drag the Chart control onto the page, set a few properties and either bind it to
a data source control or write a few lines of code that get and bind the data of interest. When a page with a Chart control is visited by a user, the Chart control renders
an <img> element on the page that displays the rendered chart.
The Chart control is great for displaying a chart on a web page, but what if a user wants to view that chart offline, or send the chart to a colleague? In an earlier installment, Programmatically Generating Chart Images, we examined a number of ways to generate the chart image programmatically. This technique is useful if you want to modify the chart image before displaying it (to, say, add a watermark) or if you want to send the chart to a recipient via email. This technique can also be used to allow the visitor to export the chart image into an alternative format.
This article shows how to let users export a chart from a web page to an alternative format. Specifically, we'll look at adding an "Export" button to the chart web page that, when clicked, exports the chart displayed in the web page to either an image file that can be downloaded or as a PDF file.
Displaying Files and Folders in a GridView
The .NET Framework provides a variety of classes in the System.IO namespace that
simplify working with the file system. Using these classes it's possible to delete files and folders, to create new files, to edit existing files, and more. These
classes, combined with ASP.NET's suite of Web controls and databinding syntax, make it quite easy to present information about the files on the web server's file system
to visitors to your website. With a bit of markup and code, it's possible to add a simple file browser to a web page that allows users to view the files and folders from
a particular directory on the web server. Such file browsers are useful if you let users upload content to the website and need to let them view their uploaded content.
If you have a folder that contains user-accessible content like images, PDF files and Word documents, a file browser offers a quick and easy way for users to see what
content is available and to view content of interest.
Back in 2003 I wrote an article titled Displaying the Files in a Directory using a DataGrid that showed how to list the files of a particular folder in a DataGrid Web control. This dated article still attracts a decent amount of traffic and questions from readers, so much so that I thought it worthwhile to update the content to use the latest technology, namely ASP.NET 4 and the GridView Web control. I also added some new features. For example, the file browser now lists both files and folders, allowing users to view the files in subfolders. Also, I moved the markup and code into a User Control, which simplifies adding the file browser to an ASP.NET page. This article walks through this new, updated version; the complete, working code is available for download at the end of this article.
Accessing Embedded Resources through a URL using WebResource.axd
Many of the built-in ASP.NET server controls require additional, external resources in order to function properly. For example,
when using any of the ASP.NET validation controls, the
controls rely on a bevy of JavaScript functions to perform their client-side validation. While each validation control could
emit such script directly into the page's content, a more efficient approach would be to package these JavaScript functions into
an external JavaScript file and then include that file in the page using <script src="PathToExternalJavaScriptFile" type="text/javascript" >.
This would reduce the total page size and would allow the browser to cache the external JavaScript file (rather than having to
send the JavaScript code down to the browser on each and every page visit/postback).
Prior to ASP.NET 2.0, such external resources that needed to be accessible to the visitor's browser had to be implemented as
actual files on the file system. If you've worked with ASP.NET 1.x's validation controls, your pages have included a reference
to a JavaScript file /aspnet_client/system_web/version/WebUIValidation.js and there is an actual file
with that name residing in the web application's root. Such external resources hamper deployment - if you deploy your
application from the testing server to production, it's imperative that the production server have the same external resources
(WebUIValidation.js, in this case), in the same locations in the file system.
To remedy this, ASP.NET 2.0 allows for external resources to be embedded within the control's assembly and then be accessed
through a specified URL. With the external images, JavaScript files, CSS files embedded in the control's assembly,
deployment is a breeze, as all of the resources are now contained within the assembly (the .dll file).
There are no external resources whose file names and location on the file system must map up. Once embedded into the assembly,
these resources can be accessed from an ASP.NET 2.0 web page through a special URL (WebResource.axd)..


Syndicate