Controls :: Print (Export) TextBox Contents As PDF Using ITextSharp

Apr 2, 2013

I want to print  one TexBox (TextMode = "MultiLine") to  pdf with ITEXTSHARP !!

My problem is that when I print the textbox contained ,he displays contained in html forma

Here is my code printing

PdfPTable TblB = new PdfPTable(1);
float[] Awidthss = new float[] { 4f};
TblB.SetWidths(Awidthss);

PdfPCell B1 = new PdfPCell(new Phrase(10, " ", f3));
B1.BackgroundColor = new BaseColor(ColorTranslator.FromHtml("#e9e9e9"));

[Code]..

View 1 Replies


Similar Messages:

C# - Take A Textbox And Print The Contents In A Url (MVC3)?

Mar 19, 2011

I have a view with a textbox and a button. I want to take the textbox and take the contents of what a user types in and put it as a "Get" variable in the URL. Does anyone have a simple example of this? I want it to print into a url like this: /Profiles/Search?searchstring=hello

I am using razor built in mvc3 view

View 1 Replies

Controls :: How To Read PDF File Contents Using ITextSharp

Sep 16, 2013

how to read pdf in C#

View 1 Replies

Controls :: Extract Contents From PDF File Using ITextSharp C#

Sep 20, 2013

Code to extract from starting word to the ending word in pdf.

for example in the below part of pdf file i wan to extract para from Jana-gana to jaya jaya jaya jaya he...

(1) The composition consisting of the words and music of the first stanza ofthe late poet Rabindra Nath Tagore’s song known as “Jana Gana Mana” isthe National Anthem of India.

It reads as follows: -Jana-gana-mana-adhinayaka jaya heBharata-bhagya-vidhataPanjaba-Sindhu-Gujarata-MarathaDravida-Utkala-BangaVindhya-Himachala-Yamuna-Gangauchchala-jaladhi-tarangaTava Subha name jage, tave subha asisa mage,gahe tava jaya-gatha.Jana-gana-mangala-dayaka jaya heBharata-bhagya-vidhata.Jaya he, Jaya he, Jaya he,jaya jaya jaya jaya he.

The above is the full version of the Anthem and its playing time isapproximately 52 seconds.

View 1 Replies

Controls :: How To Read PDF File And Extract Contents Using ITextSharp

Jun 16, 2013

I want to read a pdf file which contains empid and code for 100 nos.. in front end I'll give specific empid..then the corresponding code has to be displayed in the textbox by reading pdf.. I know this can be done by itesxtsharp.dll and regex..

View 1 Replies

Controls :: Export PDF - Use External CSS With ITextSharp

Jan 16, 2013

When converting an aspx page to pdf using itextsharp external css is not working.I dont want to create  tables for exporting to PDf as its a complex design .I am able to generate the pdf but css is not getting applied. I am  using the latest relese of itextsharp.dll.

Protected Sub btnExport_Click(ByVal sender As Object, ByVal e As EventArgs)Response.ContentType = "application/pdf"Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf")Response.Cache.SetCacheability(HttpCacheability.NoCache)Dim sw As New StringWriter()Dim hw As New HtmlTextWriter(sw)Me.Page.RenderControl(hw)Dim sr As New StringReader(sw.ToString())Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)Dim htmlparser As New HTMLWorker(pdfDoc)PdfWriter.GetInstance(pdfDoc, Response.OutputStream)pdfDoc.Open()htmlparser.Parse(sr)pdfDoc.Close()Response.Write(pdfDoc)Response.[End]()End Sub

I am using above code but getting error:

  htmlparser.Parse(sr)    

is not defining  proper path for the images:

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:ImagesLayoutan-Logo.png'.

View 1 Replies

Controls :: Export GridView With Images To PDF Using ITextSharp

Mar 4, 2013

Before converting a gridview to PDF I can modify the font size and color using:

gridview.HeaderRow.Style.Add("font-family","Arial, Helvetica, sans-serif;"); gridview.HeaderRow.Style.Add("font-size","7.20px"); gridview.HeaderRow.Style.Add("color","#284775"); 

gridview.Style.Add("font-family","Arial, Helvetica, sans-serif;");
gridview.Style.Add("font-size","6px");

The gridview has different column widths because of the information that is being displayed, those sizes are set .aspx file. But, the generated pdf file auto adjusts the width of each column to be the same size, therefore the information is shrinked and doesnt look good..

I tried the following:

gridview.Width =100;
or
gridview.Style.Add("width","100"); 
or
gridview.Columns[3].ItemStyle.Width =Unit.Pixel(10);

And many more but haven't been able to adjust the gridview to it's original columns width. How can I do that?

This is the code I use to generate the PDF file:

Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=UserDetails.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);

[Code] .....

View 1 Replies

Controls :: Export Chemical Formula To PDF Using ITextSharp

Oct 21, 2015

I am having a label on web form which contains chemical formula, when I am exporting web form in pdf using iTextSharp it displaying like this :

<p>C<sub>32</sub>H<sub>16</sub>CuN<sub>8</sub></p>

I want to display like this in pdf C32H16CuN8

StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
lblChemicalFormula.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
HTMLWorker htmlparser = new HTMLWorker(document);

[Code] ....

View 1 Replies

Controls :: Export Multiple Charts To PDF Using ITextSharp Library?

Jan 30, 2013

How do i export multiple charts to pdf using iText library?

View 1 Replies

Controls :: Export Search Results In GridView To PDF Using ITextSharp

Sep 24, 2013

In my gridview I am selecting data using search textbox....

I want to make pdf file of the searched data....

but when I clicked on my pdfbutton after searching data it make the pdf file of all data present in my table....

View 1 Replies

Controls :: Export To PDF Using ITextSharp HTML Parser Error

Feb 20, 2013

How to save webpage as pdf...    Am using asp.net 4.0 and oracle 10g. and code behind language as vb.net.I have one button. that converts the web page to pdf.It shows Could not find file 'C:....' in  htmlparser.Parse(sr) error... 

Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=psno.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()

[code].....

View 1 Replies

Controls :: ITextSharp - Export HTML To Multiple PDF Pages Using C#

May 7, 2015

I am creating a pdf document with fields from sql database using iTextsharp,after a client inputs information, the next button is pressed each page is saved  in new row with page01,page02 etc as a column within that database. I would like iTextsharp to loop and create a new page based on this page number and have one pdf doc. my code is as below.

protected void GenerateReport(object sender, EventArgs e)
{
DataRow dr = GetData("SELECT * FROM OnSiteWorkTx where DocID = " + DropDownListPdf.SelectedItem.Value).Rows[0]; ;

[Code].....

View 1 Replies

Controls :: Export GridView Populated Using JQuery AJAX To PDF Using ITextSharp

May 7, 2015

I am using ITextSharp to create a pdf. But when I am binding data to Gridview dynamically which was actually a result of ajax webmethod, its showing a blank PDF file. So how can I export dynamically binded data to GridView to PDF. Is there any other way to export dynamically binded gridview data to PDF?

View 1 Replies

Controls :: Export Repeater Item (Row) On Separate Page In PDF Using ITextSharp

May 7, 2015

I want to convert a repated contents of a repeater (binded from databse )to pdf using iTextSharp so that every repeated contents comes in new pdf page.. two or multiple unique records should come individually in new pdf page.

Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Registrations.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();

[Code] .....

View 1 Replies

Controls :: GridView Export To PDF Using ITextSharp Results In Empty Document?

Apr 1, 2013

I m doing a project to export the data from Gridview to PDF. Everything was fine and a new pdf document has been opened whenever I click the PDF image but there was no records displayed in it.

I have 15 records in Gridview and those records have displayed using Table Adapter. I used the Sand and Sky Auto Formatting option in Gridview and color, tablecell width, 15 rows are displayed perfectly in PDF without the text. what am I missing.

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;

[code]....

View 1 Replies

Data Controls :: Export GridView To PDF Using ITextSharp - Document Has No Pages

Jan 7, 2013

I am running into a problem with the btnPdf.on pdfDoc.Close it gives me an IOException was unhandled by user code.. The detail is The document has no pages.. I have a populated grid.. The only changes I made were to change the filename to filename LotGrid.pdf and the grid name to the name of my gridview..

View 1 Replies

Controls :: ITextSharp Export To PDF Error - Could Not Find A Part Of The Path

Jun 6, 2013

I convert my webpage to pdf  i got this error

Server Error in '/POD/POMLNT' Application.
--------------------------------------------------------------------------------

Could not find a part of the path 'c:windowssystem32inetsrvPOMLNTImagesPhotos333827.jpg'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:windowssystem32inetsrvPOMLNTImagesPhotos333827.jpg'.

Source Error:
Line 270: PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
Line 271: pdfDoc.Open()
Line 272: htmlparser.Parse(sr)
Line 273: pdfDoc.Close()
Line 274: Response.Write(pdfDoc)

Source File: D:websitesDevelopmentalPODPOMLNTPOMLNTonepage.aspx.vb Line: 272

View 1 Replies

Data Controls :: Print DataList Control Contents Using JavaScript?

Apr 23, 2012

I would like to print the contents of my ASP.Net datalist control using JavaScript. I also want to allow user to see preview before printing.

View 1 Replies

Data Controls :: Print GridView Contents With Header Repeated On Each Page To A4 Sheet

Aug 31, 2013

I have a grid view which consists of some 16 fields in which i have to take print in A4 sheet

In which every sheet the page must contain headers

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Report_AssistantEngineer.aspx.cs" Inherits="Report_AssistantEngineer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">

[Code] ....

View 1 Replies

C# - ItextSharp Expected A Dict Object When Trying To Print?

Jan 31, 2011

I have a web page that allows a user to view a pdf and print pdf. The print pdf is a copy of the display pdf and i am using ItextSharp to inject the javascript to allow auto printing. I have a method that allows a user to upload a pdf and it calls this method below to copy the display copy into a pdf. Both pdf's are then saved in the database. However , when a user goes to click on the print button on my web page they receive the following error "expected a dict object". below is my code that adds in the auto print, which works fine for me but not on my clients site.

I am doing anything wrong that could be corrupting the file. The original pdf content is passed in as a Binary Object. Also i am using ASP.NET MVC2.

MemoryStream originalPdf = new MemoryStream(Content.BinaryData);
MemoryStream updatedPdf = new MemoryStream();
updatedPdf.Write(Content.BinaryData,0, Content.BinaryData.Length);[code]....

View 1 Replies

Forms Data Controls :: Gridview Export To Excel, To Keep Row Height From Autofitting To Contents?

Jun 1, 2010

I have a 2008 c# application that displays data in a gridview. Two of the columns can contain text up to 500 characters. I have been able to handle these in the gridview by displaying the long text in a scrolling div tag. That works fine in the gridview, but when I export the gridview to excel, the row-height autofits to the large text fields, giving extremely tall rows. Any idea on how I can control the formatting to limit the row-height for the output excel spreadsheet? The approach I use for the export is described in

http://mattberseth.com/downloads/GridViewExportUtil.cs.

View 4 Replies

C# - Get The Export Value Of A Checkbox Using ITextSharp?

Dec 20, 2010

I'm working on dynamically filling in the fields on a pdf document using ITextSharp. I'd like to be able to determine the "export value" of the checkbox is from the codebehind in order to determine what value to send to this checkbox if it should be checked. Most of the documents I've worked with in the past had the same export value for every check box but the one I'm currently working with varies from checkbox to checkbox. I could go through all of the text boxes and make them consistent but it would save a lot of time in the future if I could just determine what the export value of these checkboxes are at runtime and set them accordingly.I tried to implement the solution below in C# and ended up with the following code:

public string GetCheckBoxExportValue(AcroFields pdfDocument, string checkBoxFieldName)
{
AcroFields.Item item = pdfDocument.GetFieldItem(checkBoxFieldName);

[code]...

View 1 Replies

Get Info From GridView DB And Print It To PDF - Background Color For ITextSharp

Jan 22, 2012

I am making a page that can get some info from a DB from a gridview and then print it to a PDF file. But I am having problems with the background color. If I use this line of code

Code : cell.BackgroundColor = New Color(System.Drawing.ColorTranslator.FromHtml("#008000"))

Then i get this error : System.Drawing.Color' has no constructors

If i changes it to this code

Code : cell.BackgroundColor = System.Drawing.ColorTranslator.FromHtml("#008000")

Then I get this error: Value of type 'System.Drawing.Color' cannot be converted to 'iTextSharp.text.BaseColor'.

My code is: (the error is underline)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cmd As New OleDbCommand()
Dim myAdapter As New OleDbDataAdapter()
Dim myDataSet As New DataSet()
cmd.CommandType = CommandType.Text
cmd.CommandText = "select CustomerID,City,Country from customers"

[Code] .....

View 4 Replies

VS 2008 How To Export Gridview To Pdf Using ITextSharp

Jan 26, 2011

I'm trying to export my gridview to pdf but the html parsing of the iTextSharp control seems to be failing. I have to create an HtmlForm like below and add the gridview to it because the code is in a custom control, so I cant pass the gridview directly. I get an error saying "gridview must be in a form tag with runat=server"

If I don't insert the test header like i do below, I get an error saying "document has no pages"

At the moment the pdf is generated but it only has the text "testing".

The htmlform html doesn't get parsed i think. Here is a small portion of what the newHtml variable below contains when I create it.

Code:

[code]....

View 3 Replies

Export Gridview To PDF Document Using ItextSharp DLL

Jan 28, 2013

I'm using ItextSharp dll to export my gridview to a pdf document. When it executes htmlworker.Parse(streamreader) I get an error:

Could not find file 'C:Program FilesCommon FilesMicrosoft SharedDevServer10.0 '. I never specified this path. How I can resolve this error?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved