16,021,687 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by MikeVaros (Top 9 by date)
MikeVaros
20-Aug-12 8:39am
View
I didn't notice that ddltext in this example I posted, but I've tried several combinations of those variables. I have the editor declared as
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit.HTMLEditor" tagprefix="cc1" %> And then later on as <cc1:Editor ID="Editor1" runat="server" Height="500px" /> as shown above.
The only way I can seem to get this to work is to sack the Jquery completely and try to append it to the end of the Html Editor's content on the SelectedIndexChanged event of the ComboBox. But this doesn't meet my requirement. I have been pulling my hair out for days trying to figure this out, and I have gotten nowhere. Any help you can offer would be greatly appreciated.
MikeVaros
6-Jul-12 13:36pm
View
I feel like an idiot now. But I suppose I'd prefer it was something simple as opposed to a logic error. I was using the horizontal line tag in each of the html pages I was trying to run through the program. And it doesn't look like HTMLWorker has any methodology for handling this tag. The reason my hard-coded HTML worked was because I didn't use that tag in there. I was just doing a short snippet in a string. I figured it out the second I tried to insert one of those "hr" tags into that string. Instantly got a Null Reference Exception, and it clicked.
Thank you for helping, and I'll keep that in mind about the <br> tags if I notice any formatting issues with the string builder.
Mike
MikeVaros
6-Jul-12 11:59am
View
It only seems to error out when that string "html" is created with a stringbuilder object. So the problem is there. The only problem is, that sb object renders the correct output to the textbox, so I know it isn't empty. And it doesn't truncate any text, so I know it isn't going beyond capacity.
MikeVaros
6-Jul-12 11:55am
View
I'll paste in my stack trace. It's pretty large to describe easily.
at iTextSharp.text.html.simpleparser.HTMLWorker.CreateLineSeparator(IDictionary`2 attrs)
at iTextSharp.text.html.simpleparser.HTMLTagProcessors.HTMLTagProcessor_HR.StartElement(HTMLWorker worker, String tag, IDictionary`2 attrs)
at iTextSharp.text.html.simpleparser.HTMLWorker.StartElement(String tag, IDictionary`2 attrs)
at iTextSharp.text.xml.simpleparser.SimpleXMLParser.ProcessTag(Boolean start)
at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Go(TextReader reader)
at iTextSharp.text.xml.simpleparser.SimpleXMLParser.Parse(ISimpleXMLDocHandler doc, ISimpleXMLDocHandlerComment comment, TextReader r, Boolean html)
at iTextSharp.text.html.simpleparser.HTMLWorker.Parse(TextReader reader)
at iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(TextReader reader, StyleSheet style, IDictionary`2 tags, Dictionary`2 providers)
at iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(TextReader reader, StyleSheet style, Dictionary`2 providers)
at iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(TextReader reader, StyleSheet style)
Thank you for your help,
Mike
MikeVaros
6-Jul-12 11:43am
View
"Cannot convert from 'string' to 'System.IO.TextReader'" I'm almost positive I tried that myself yesterday, but I figured it may be worth a shot. Thank you for the response though. It seems to think that the "store" String is empty. If I manually enter the html as a string, it works perfectly, but this isn't dynamic enough to suit my needs. I'm banging my head off the wall trying to figure this out.
I'm just going out on a limb here, but if the size of the string exceeds Stringbuilder's default capacity, could it return a null exception?
MikeVaros
20-Jun-12 13:46pm
View
I apologize, it is an extremely complicated question, but I tried to be as specific as I can. I'll explain what my program does right now, and what I want to add to it. Right now, it takes a pdf template with repeating form fields like "MeterNumber1" "MeterNumber2" and iterates through a loop to assign database values to each form field like that.
How I have that working is using the integer "c" to increment by 1 every time the loop iterates. So the original pass will insert the meter_no database value matching it to the field"MeterNumber1" in the PDF it generates from that template. The next pass would do the same thing, but since the integer "c" incremented in the loop, it would write the value to "MeterNumber2". So that can loop through as many times as is needed, but it will only write as many values to the pdf as there are fields present (currently 5).
What I want to do, is to set a condition so that if the incrementing integer "c" exceeds 5, it adds a new page to the document, where I would eventually dynamically create a table to handle the additional results. I have dug around all morning looking for a way to get this to work.
Every example always uses the command, document.NewPage(); however as you can see from my code, I do not reference the Document Class anywhere, and I have no idea how I could even fit it into the project currently. This is mainly because I am a c# novice still, so I don't fully understand the relationships between functions yet. My best guess is that I would have to eliminate one of the strings that declares the Path the pdf is written to, and use the Document Class in it's place.
The template that pdfStamper writes to:
string pdfTemplate = openFileDialog.FileName;
The Pdf that is generated after pdfStamper is finished inserting field values:
string newFile = @"c:\Data\" + Guid.NewGuid().ToString() + "TableForm.pdf";
I'm sorry if that made it seem even more complicated, but it's what I need to do for this project. I'll do my best to simplify my problem right here. How do I add a page to the PDF called out in the newFile String?
MikeVaros
18-Jun-12 14:01pm
View
Do you really think that would be necessary since I'm only using SELECT statements? I'm not a seasoned vet when it comes to SQL, so there's a good chance I'm wrong, and setting the Parameter Property is useful. My instinct would just tell me that if I was actually updating rows, I would need to have some security in place to prevent the query being hijacked. The data from the SELECT statements is processed, and inserted dynamically into PDF Forms.
MikeVaros
15-Jun-12 10:39am
View
Thank you for the response, and the article. I'm actually basing this project roughly off of a C# Project by the same person who wrote the article you posted. I was able to get that assembly reference error to go away by starting a new project from scratch. But I changed that foreach above, because I'm getting other errors now. This is the code I have now. I did have the DLL Installed, and I referenced it. I am still relatively new to C#. At first the error stated it could not convert Dictionary Entry, and when I researched that, someone suggested using KeyValuePair instead)
foreach (KeyVaulePair<string, AcroFields.Item> de in pdfReader.AcroFields.Fields)
{
sb.Append(de.Key.ToString() + Environment.NewLine);
}
And these are the two errors I am getting now
Cannot convert type 'System.Collections.Generic.KeyValuePair<string,itextsharp.text.pdf.acrofields.item>' to 'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>'
And
'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>' does not contain a definition for 'Key' and no extension method 'Key' accepting a first argument of type 'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>' could be found (are you missing a using directive or an assembly reference?)
MikeVaros
15-Jun-12 10:39am
View
Deleted
Thank you for the response, and the article. I'm actually basing this project roughly off of a C# Project by the same person who wrote the article you posted. I was able to get that assembly reference error to go away by starting a new project from scratch. But I changed that foreach above, because I'm getting other errors now. This is the code I have now. I did have the DLL Installed, and I referenced it. I am still relatively new to C#. At first the error stated it could not convert Dictionary Entry, and when I researched that, someone suggested using KeyValuePair instead)
Collapse | Copy Code
<pre lang="xml">foreach (KeyVaulePair<string, acrofields.item=""> de in pdfReader.AcroFields.Fields)
{
sb.Append(de.Key.ToString() + Environment.NewLine);
}
And these are the two errors I am getting now
Cannot convert type 'System.Collections.Generic.KeyValuePair<string,itextsharp.text.pdf.acrofields.item>' to 'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>'
And
'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>' does not contain a definition for 'Key' and no extension method 'Key' accepting a first argument of type 'PDFFieldExtractor.KeyVaulePair<string,itextsharp.text.pdf.acrofields.item>' could be found (are you missing a using directive or an assembly reference?)
Show More