<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Criando um documento Pdf com iTextSharp &#8211; Parte VII (Estilos)</title>
	<atom:link href="http://www.dotnetmax.org/2009/07/07/criando-um-documento-pdf-com-itextsharp-parte-vii/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetmax.org/2009/07/07/criando-um-documento-pdf-com-itextsharp-parte-vii/</link>
	<description>Conhecimento na Nuvem...</description>
	<lastBuildDate>Wed, 04 Jan 2012 15:39:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: hermes handbags</title>
		<link>http://www.dotnetmax.org/2009/07/07/criando-um-documento-pdf-com-itextsharp-parte-vii/comment-page-1/#comment-2120</link>
		<dc:creator>hermes handbags</dc:creator>
		<pubDate>Wed, 05 Oct 2011 18:42:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.dotnetmax.org/?p=548#comment-2120</guid>
		<description>You appear to be incredibly specialist in the way you write.</description>
		<content:encoded><![CDATA[<p>You appear to be incredibly specialist in the way you write.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcelo Moreira</title>
		<link>http://www.dotnetmax.org/2009/07/07/criando-um-documento-pdf-com-itextsharp-parte-vii/comment-page-1/#comment-1677</link>
		<dc:creator>Marcelo Moreira</dc:creator>
		<pubDate>Mon, 08 Aug 2011 20:26:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.dotnetmax.org/?p=548#comment-1677</guid>
		<description>Utilizo a rotina abaixo para gerar PDF, o grande problema é que utilizo o FCKEditor componente que permite edição de texto via web. Ex: o usuário digita um texto a esquerda e coloca uma imagem a direita deste texto, ao invés de exibir no PDF exatamente assim, ele exibi o texto e depois na linha debaixo o texto alinhado a direita.
Acredito que o erro esteja nesta linha:
ArrayList array = HTMLWorker.ParseToList(tempReader, new StyleSheet());
Como ele monta um array fica em linhas diferentes o texto e depois a imagem.
Algum de voces tem alguma solução para isto?
private void GeraPDFItextSharp(string html, string fileName, string author, string subject)
{
if (!string.IsNullOrEmpty(html) &amp;&amp; !string.IsNullOrEmpty(fileName) &amp;&amp;
!
string.IsNullOrEmpty(author) &amp;&amp; !string.IsNullOrEmpty(subject))
{
try
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader(&quot;content-disposition&quot;, string.Format(&quot;attachment;filename={0}.pdf&quot;, fileName));
HttpContext.Current.Response.Charset = string.Empty;
HttpContext.Current.Response.ContentType = &quot;application/pdf&quot;;
HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
EnableViewState =
true;
int ContadorPagina = 1;
Document document = new Document(PageSize.A4, 36, 36, 38, 30);
PdfWriter pdfWriter = PdfWriter.GetInstance(document, HttpContext.Current.Response.OutputStream);
document.AddAuthor(author);
document.AddSubject(subject);
document.Open();
//Adiciona a marca d&#039;gua
iTextSharp.text.
Image Topo = iTextSharp.text.Image.GetInstance(@&quot;&quot; + ConfigurationManager.AppSettings[&quot;Imagens&quot;].ToString() + &quot;/header_veirano_novo.jpg&quot;);
iTextSharp.text.
Image Rodape = iTextSharp.text.Image.GetInstance(@&quot;&quot; + ConfigurationManager.AppSettings[&quot;Imagens&quot;].ToString() + &quot;/rodapeClipping.png&quot;);
document.SetPageSize(
PageSize.A4);
Paragraph ph = new Paragraph();
ph.Add(
new Chunk(&quot;\n&quot;));
Topo.SetAbsolutePosition(36, 785);
Rodape.SetAbsolutePosition(36, 10);
document.Add(Topo);
document.Add(ph);
document.Add(Rodape);
document.Add(ph);
string tempFile = Path.GetTempFileName();
using (StreamWriter tempwriter = new StreamWriter(tempFile, false))
{
tempwriter.Write(html);
}
using (StreamReader tempReader = new StreamReader(tempFile))
{
ArrayList array = HTMLWorker.ParseToList(tempReader, new StyleSheet());
for (int i = 0; i &lt; array.Count; i++)
{
document.Add((
IElement)array[i]);
if (pdfWriter.PageNumber != ContadorPagina)
{
Paragraph phi = new Paragraph();
phi.Add(
new Chunk(&quot;\n&quot;));
Topo.SetAbsolutePosition(36, 785);
Rodape.SetAbsolutePosition(36, 10);
document.Add(Topo);
document.Add(phi);
document.Add(Rodape);
document.Add(phi);
}
ContadorPagina = pdfWriter.PageNumber;
}
}
document.Close();
pdfWriter.Close();
File.Delete(tempFile);
HttpContext.Current.Response.Flush();
}
catch (Exception ex)
{
throw ex;
}
}
}</description>
		<content:encoded><![CDATA[<p>Utilizo a rotina abaixo para gerar PDF, o grande problema é que utilizo o FCKEditor componente que permite edição de texto via web. Ex: o usuário digita um texto a esquerda e coloca uma imagem a direita deste texto, ao invés de exibir no PDF exatamente assim, ele exibi o texto e depois na linha debaixo o texto alinhado a direita.</p>
<p>Acredito que o erro esteja nesta linha:</p>
<p>ArrayList array = HTMLWorker.ParseToList(tempReader, new StyleSheet());</p>
<p>Como ele monta um array fica em linhas diferentes o texto e depois a imagem.</p>
<p>Algum de voces tem alguma solução para isto?</p>
<p>private void GeraPDFItextSharp(string html, string fileName, string author, string subject)</p>
<p>{</p>
<p>if (!string.IsNullOrEmpty(html) &amp;&amp; !string.IsNullOrEmpty(fileName) &amp;&amp;</p>
<p>!</p>
<p>string.IsNullOrEmpty(author) &amp;&amp; !string.IsNullOrEmpty(subject))<br />
{</p>
<p>try<br />
{</p>
<p>HttpContext.Current.Response.Clear(); </p>
<p>HttpContext.Current.Response.AddHeader(&#8220;content-disposition&#8221;, string.Format(&#8220;attachment;filename={0}.pdf&#8221;, fileName)); </p>
<p>HttpContext.Current.Response.Charset = string.Empty; </p>
<p>HttpContext.Current.Response.ContentType = &#8220;application/pdf&#8221;; </p>
<p>HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;<br />
EnableViewState =</p>
<p>true; </p>
<p>int ContadorPagina = 1; </p>
<p>Document document = new Document(PageSize.A4, 36, 36, 38, 30); </p>
<p>PdfWriter pdfWriter = PdfWriter.GetInstance(document, HttpContext.Current.Response.OutputStream);<br />
document.AddAuthor(author);</p>
<p>document.AddSubject(subject);</p>
<p>document.Open();</p>
<p>//Adiciona a marca d&#8217;gua<br />
iTextSharp.text.</p>
<p>Image Topo = iTextSharp.text.Image.GetInstance(@&#8221;" + ConfigurationManager.AppSettings["Imagens"].ToString() + &#8220;/header_veirano_novo.jpg&#8221;);<br />
iTextSharp.text.</p>
<p>Image Rodape = iTextSharp.text.Image.GetInstance(@&#8221;" + ConfigurationManager.AppSettings["Imagens"].ToString() + &#8220;/rodapeClipping.png&#8221;);<br />
document.SetPageSize(</p>
<p>PageSize.A4); </p>
<p>Paragraph ph = new Paragraph();<br />
ph.Add(</p>
<p>new Chunk(&#8220;\n&#8221;));<br />
Topo.SetAbsolutePosition(36, 785);</p>
<p>Rodape.SetAbsolutePosition(36, 10);</p>
<p>document.Add(Topo);</p>
<p>document.Add(ph);</p>
<p>document.Add(Rodape);</p>
<p>document.Add(ph);</p>
<p>string tempFile = Path.GetTempFileName(); </p>
<p>using (StreamWriter tempwriter = new StreamWriter(tempFile, false))<br />
{</p>
<p>tempwriter.Write(html);</p>
<p>}</p>
<p>using (StreamReader tempReader = new StreamReader(tempFile))<br />
{</p>
<p>ArrayList array = HTMLWorker.ParseToList(tempReader, new StyleSheet()); </p>
<p>for (int i = 0; i &lt; array.Count; i++)<br />
{</p>
<p>document.Add((</p>
<p>IElement)array[i]); </p>
<p>if (pdfWriter.PageNumber != ContadorPagina)<br />
{</p>
<p>Paragraph phi = new Paragraph();<br />
phi.Add(</p>
<p>new Chunk(&quot;\n&quot;));<br />
Topo.SetAbsolutePosition(36, 785);</p>
<p>Rodape.SetAbsolutePosition(36, 10);</p>
<p>document.Add(Topo);</p>
<p>document.Add(phi);</p>
<p>document.Add(Rodape);</p>
<p>document.Add(phi);</p>
<p>}</p>
<p>ContadorPagina = pdfWriter.PageNumber;</p>
<p>}</p>
<p>}</p>
<p>document.Close();</p>
<p>pdfWriter.Close();</p>
<p>File.Delete(tempFile); </p>
<p>HttpContext.Current.Response.Flush();<br />
}</p>
<p>catch (Exception ex)<br />
{</p>
<p>throw ex;<br />
}</p>
<p>}</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Besaleel</title>
		<link>http://www.dotnetmax.org/2009/07/07/criando-um-documento-pdf-com-itextsharp-parte-vii/comment-page-1/#comment-369</link>
		<dc:creator>Besaleel</dc:creator>
		<pubDate>Thu, 23 Sep 2010 12:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.dotnetmax.org/?p=548#comment-369</guid>
		<description>Legal, gostei dos exemplos bem simples, mas,... se eu quiser imprimir uma URL, que é mais interessante.
Por exemplo, vamos dar mais utilidade a ferramenta iTextSharp:
Eu tenho um relatório em HTML ( http://meusite.com/rel.aspx?id=91881 )
quero disponibilizar esses dados em PDF.
Como faço isso usando o iTextSharp?
Não encontrei nenhuma referencia a URL na classe Documento.</description>
		<content:encoded><![CDATA[<p>Legal, gostei dos exemplos bem simples, mas,&#8230; se eu quiser imprimir uma URL, que é mais interessante.<br />
Por exemplo, vamos dar mais utilidade a ferramenta iTextSharp:</p>
<p>Eu tenho um relatório em HTML ( <a href="http://meusite.com/rel.aspx?id=91881" rel="nofollow">http://meusite.com/rel.aspx?id=91881</a> )<br />
quero disponibilizar esses dados em PDF.<br />
Como faço isso usando o iTextSharp?</p>
<p>Não encontrei nenhuma referencia a URL na classe Documento.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

