Hello,

I'm using iTextSharp whit ASP.NET and C#.

Everything works fine if i run the application on the server, but if i'm using 
the application from outside de LAN i can't generate PDF... The error is always 
on this line: System.Collections.ArrayList objects = 
iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(strReader, styles);

I need help!!

Thanks in advance!

//Tipo de documento
                        Document document = new Document(PageSize.A4, 50, 50, 
30, 30);

                        string url = GetURL();

                        try
                        {
                                /*
                                 * Cria o documento PDF
                                 */
                                PdfWriter myWriter = 
PdfWriter.GetInstance(document, new FileStream(strPDFpath, FileMode.Create));

                                // Abre o documento
                                document.Open();

                                /*
                                 * Adiciona ao documento a folha de estilos
                                 */
                                document.Add(new 
Header(iTextSharp.text.html.Markup.HTML_ATTR_STYLESHEET, "Style.css"));


                                /*
                                 * Cria um objectos de estilos
                                 */
                                iTextSharp.text.html.simpleparser.StyleSheet 
styles = new iTextSharp.text.html.simpleparser.StyleSheet();

                                styles.LoadTagStyle("ol", "leading", "16,0");
                                styles.LoadTagStyle("li", "face", "calibri");
                                styles.LoadTagStyle("span", "size", "8px");
                                styles.LoadTagStyle("body", "font-family", 
"calibri");
                                styles.LoadTagStyle("body", "font-size", 
"10px");

                                document.NewPage();


                                /*
                                 * Rodape
                                 */
                                Phrase foot = new Phrase(GetRodape(autor), 
FontFactory.GetFont(FontFactory.HELVETICA_BOLD, 7, iTextSharp.text.Font.NORMAL, 
iTextSharp.text.Color.GRAY));
                                HeaderFooter footer = new HeaderFooter(foot, 
false);
                                footer.Border = Rectangle.NO_BORDER;
                                footer.Alignment = Element.ALIGN_CENTER;
                                document.Footer = footer;


                                /*
                                 * Parse do ficheiro html para o PDF
                                 */


                                StreamReader strReader = new 
StreamReader(strHTMLpathFile, Encoding.UTF8, true);
                                
                                System.Collections.ArrayList objects = 
iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(strReader, styles);


                                for (int k = 0; k < objects.Count; k++)
                                {
                                        document.Add((IElement)objects[k]);
                                }

                                strReader.Close();
                                strReader.Dispose();
                                strReader = null;



                                /*
                                 * Propriedades do documento
                                 */
                                document.AddSubject(title + "_" + 
Personalizacao.Aplicacao.GetInstituicaoIniciais() + "_" + 
System.DateTime.Now.Year.ToString() + "_Todos os direitos reservados.");
                                document.AddTitle(title);
                                document.AddAuthor(autor);
                                document.AddCreationDate();


                                /*
                                 * Adiciona o gráfico ao PDF
                                 */
                                if (grafico)
                                {
                                        iTextSharp.text.Image grafico1 = 
iTextSharp.text.Image.GetInstance(url + "/PDF/" + id + 
"_zedgraph_questionarios.png");
                                        grafico1.Alignment = 
Element.ALIGN_CENTER;
                                        grafico1.ScalePercent(60);
                                        document.Add(grafico1);
                                }

                        }
                        catch (DocumentException ex1)
                        {
                                throw ex1;
                        }
                        catch (IOException ex)
                        {

                                throw ex;
                        }
                        finally
                        {
                                document.Close();

                        }

--
This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com
http://www.opensubscriber.com/messages/[email protected]/topic.html

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to