Text is superimposed on image by default when converting html using HTMLWorker

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Text is superimposed on image by default when converting html using HTMLWorker

tommyp
Hi everyone,
I'm having a really annoying problem converting html to pdf. I'm using HTMLWorker and no stylesheet, trying to convert a rather simple html page with images.
My problem is, that the text on the page is superimposed on the images, as if the images were background images, or underlying.
I am not changing any attributes etc. during my HTMLWorker processing, and the alignment attribute is 0.

Any ideas about what could be the problem - any ideas are appreciated.

Thanks
>Tommy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text is superimposed on image by default when converting html using HTMLWorker

ssingh@regard-solutions.com
Try using this one....
 document.SetMargins(40, 50, 25, 30)
dim tempPath as string= Some path
dim   strPDFpath = Server.MapPath("~/PDFS/TempPDFS/") & tempPath
                        Dim styles As New iTextSharp.text.html.simpleparser.StyleSheet()
                        'styles.LoadTagStyle("ol", "leading", "16,0")
                        Dim fs As New FileStream(strPDFpath, FileMode.Create, FileAccess.Write)
                        PdfWriter.GetInstance(document, fs)
                        Dim path As String = Server.MapPath("~/App_Themes/MainTheme/")
                        path = path & "main.css"
                        document.Add(New Header(iTextSharp.text.html.Markup.HTML_ATTR_STYLESHEET, path))

                        Dim objects As ArrayList

                        styles.LoadTagStyle("li", "face", "garamond")
                        styles.LoadTagStyle("span", "size", "8px")
                        styles.LoadTagStyle("body", "font-family", "times new roman")
                        styles.LoadTagStyle("body", "font-size", "10px")
                        'styles.LoadTagStyle("HR", "page-break-after", "always")
                        document.Open()

                        document.NewPage()
                        'Add footer
                        Dim footer As New HeaderFooter(New Phrase(" "), False)
                        footer.Border = 0
                        footer.Alignment = iTextSharp.text.Element.ALIGN_CENTER
                        document.Footer = footer

                        'Dim headerPhrase As New Phrase("-")
                        'Dim header As New HeaderFooter(headerPhrase, False)
                        'header.Border = iTextSharp.text.Rectangle.NO_BORDER
                        'header.Alignment = iTextSharp.text.Element.ALIGN_LEFT
                        'header.BackgroundColor = iTextSharp.text.Color.WHITE
                        'document.Header = header

                        'doc.Add(headerPhrase)
                        'objects=itextsharp.text .html .simpleparser .HTMLWorker .
                        objects = iTextSharp.text.html.simpleparser.HTMLWorkerExtended.ParseToList(New StreamReader(strHTMLpath, Encoding.[Default]), styles)

                        For k As Integer = 0 To objects.Count - 1
                            document.Add(DirectCast(objects(k), IElement))
                        Next
                        document.Close()
                      


From: "tommyp" <[hidden email]>
Sent: Monday, August 24, 2009 6:17 AM
To: [hidden email]
Subject: [itextsharp-questions] Text is superimposed on image by default when converting html using HTMLWorker



Hi everyone,
I'm having a really annoying problem converting html to pdf. I'm using
HTMLWorker and no stylesheet, trying to convert a rather simple html page
with images.
My problem is, that the text on the page is superimposed on the images, as
if the images were background images, or underlying.
I am not changing any attributes etc. during my HTMLWorker processing, and
the alignment attribute is 0.

Any ideas about what could be the problem - any ideas are appreciated.

Thanks
>Tommy

--
View this message in context: http://www.nabble.com/Text-is-superimposed-on-image-by-default-when-converting-html-using-HTMLWorker-tp25114277p25114277.html
Sent from the itextsharp-questions mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text is superimposed on image by default when converting html using HTMLWorker

ssingh@regard-solutions.com
In reply to this post by tommyp
Hai Tommy,

Try using this one....

 document.SetMargins(40, 50, 25, 30)
dim tempPath as string= Some path
dim   strPDFpath = Server.MapPath("~/PDFS/TempPDFS/") & tempPath
                        Dim styles As New iTextSharp.text.html.simpleparser.StyleSheet()
                        'styles.LoadTagStyle("ol", "leading", "16,0")
                        Dim fs As New FileStream(strPDFpath, FileMode.Create, FileAccess.Write)
                        PdfWriter.GetInstance(document, fs)
                        Dim path As String = Server.MapPath("~/App_Themes/MainTheme/")
                        path = path & "main.css"
                        document.Add(New Header(iTextSharp.text.html.Markup.HTML_ATTR_STYLESHEET, path))

                        Dim objects As ArrayList

                        styles.LoadTagStyle("li", "face", "garamond")
                        styles.LoadTagStyle("span", "size", "8px")
                        styles.LoadTagStyle("body", "font-family", "times new roman")
                        styles.LoadTagStyle("body", "font-size", "10px")
                        'styles.LoadTagStyle("HR", "page-break-after", "always")
                        document.Open()

                        document.NewPage()
                        'Add footer
                        Dim footer As New HeaderFooter(New Phrase(" "), False)
                        footer.Border = 0
                        footer.Alignment = iTextSharp.text.Element.ALIGN_CENTER
                        document.Footer = footer

                        'Dim headerPhrase As New Phrase("-")
                        'Dim header As New HeaderFooter(headerPhrase, False)
                        'header.Border = iTextSharp.text.Rectangle.NO_BORDER
                        'header.Alignment = iTextSharp.text.Element.ALIGN_LEFT
                        'header.BackgroundColor = iTextSharp.text.Color.WHITE
                        'document.Header = header

                        'doc.Add(headerPhrase)
                        'objects=itextsharp.text .html .simpleparser .HTMLWorker .
                        objects = iTextSharp.text.html.simpleparser.HTMLWorkerExtended.ParseToList(New StreamReader(strHTMLpath, Encoding.[Default]), styles)

                        For k As Integer = 0 To objects.Count - 1
                            document.Add(DirectCast(objects(k), IElement))
                        Next
                        document.Close()


Happy Coding..
Satyendra Singh

From: "tommyp" <[hidden email]>
Sent: Monday, August 24, 2009 6:17 AM
To: [hidden email]
Subject: [itextsharp-questions] Text is superimposed on image by default when converting html using HTMLWorker



Hi everyone,
I'm having a really annoying problem converting html to pdf. I'm using
HTMLWorker and no stylesheet, trying to convert a rather simple html page
with images.
My problem is, that the text on the page is superimposed on the images, as
if the images were background images, or underlying.
I am not changing any attributes etc. during my HTMLWorker processing, and
the alignment attribute is 0.

Any ideas about what could be the problem - any ideas are appreciated.

Thanks
>Tommy

--
View this message in context: http://www.nabble.com/Text-is-superimposed-on-image-by-default-when-converting-html-using-HTMLWorker-tp25114277p25114277.html
Sent from the itextsharp-questions mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text is superimposed on image by default when converting html using HTMLWorker

tommyp
In reply to this post by tommyp
Thanks for your answer.
However, had some problems working out exactly what would make your solution fix my problems.
Now I found that when the img-tag is lacking the align attribute I get the problems - when I add the align attribute I do not have the problem.
Now, using my CMS we normally do not use align's and try to position everything using css stylesheets instead.
Any ideas about how to handle this? I'm thinking some css-tricks forcing iTextSharp to react like if an align were present, or maybe some special handling in the HTMLWorker processing?

>Tommy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Please unsubscribe me!

Madhura Raj
In reply to this post by ssingh@regard-solutions.com
Hi,

Please do unsubscribe me.

Thanks,
Mauna


      Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
itextsharp-questions mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Text is superimposed on image by default when converting html using HTMLWorker

panpan2523
This post has NOT been accepted by the mailing list yet.
In reply to this post by tommyp
Whether you are looking for a lighter or rich uggs dark indicate Cardy classic black shoes, come on. We look Uggs has been always welcome Black UGGs, ash shoes history black color not only, more uggs classic unique design, suitable for all kinds of skin, no matter how fashionable mechanism changes it is
Loading...