|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
Hello,
I'm currently building a system which creates a pdf from a selection of external html pages using html to pdf. I'm utilising the HtmlToPdf.Options.Follow functionality to merge html pages straight after one another to prevent forcing the content onto a new pdf page. The problem I am having is that I'm using different column values for each html page merged to the pdf, which is causing text to overlap. It's fine when you go from a 2 column layout to a 1 column layout but when it's the other way round, it causes text to overlap when the html flows from the left hand column to the right hand column . I get the impression that this occurs because the HtmlToPdf.Options.Follow functionality is only concerned with the starting point of proceeding merged html page and not the html that follows it.
I would appreciate any feedback you having regarding this problem.
Code for my system is below:
Dim fronturl As String = String.Format("{0}pdfgen/projectorbrochurefront.aspx?Culture={1}&PC={2}", domainURL, UserCulture, PC) Dim introurl = String.Format("{0}pdfgen/projectorbrochureintro.aspx?Culture={1}&PC={2}&IsBrochure={3}", domainURL, UserCulture, PC, "False") Dim mainurl = String.Format("{0}pdfgen/projectorbrochure.aspx?Culture={1}&PC={2}&IsBrochure={3}", domainURL, UserCulture, PC, "False") Dim backurl As String = String.Format("{0}pdfgen/projectorbrochurespec.aspx?Culture={1}&PC={2}&IsBrochure={3}", domainURL, UserCulture, PC, "True")
Dim doc As New EO.Pdf.PdfDocument() HtmlToPdf.Options.OutputArea = New RectangleF(-0.0F, -0.0F, 8.5F - -0.0F - -0.0F, 11.0F - -0.0F - -0.0F) HtmlToPdf.Options.ColumnCount = 1 HtmlToPdf.Options.PageSize = PdfPageSizes.A4 HtmlToPdf.Options.JpegQualityLevel = 100 HtmlToPdf.Options.AutoAdjustForDPI = False HtmlToPdf.ConvertUrl(fronturl, doc) HtmlToPdf.Options.ColumnCount = 1 HtmlToPdf.Options.OutputArea = New RectangleF(0.5F, 0.5F, 7.5F, 10.0F) HtmlToPdf.Options.PageSize = PdfPageSizes.A4 HtmlToPdf.Options.Follow(HtmlToPdf.ConvertUrl(introurl, doc)) HtmlToPdf.Options.ColumnCount = 2 HtmlToPdf.Options.OutputArea = New RectangleF(0.5F, 0.5F, 7.5F, 10.0F) HtmlToPdf.Options.PageSize = PdfPageSizes.A4 HtmlToPdf.Options.JpegQualityLevel = 90 HtmlToPdf.Options.AutoFitX = False HtmlToPdf.Options.AutoFitY = False HtmlToPdf.ConvertUrl(mainurl, doc) HtmlToPdf.Options.ColumnCount = 1 HtmlToPdf.ConvertUrl(backurl, doc)
Dim response As HttpResponse = HttpContext.Current.Response response.Clear() response.ClearHeaders() response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}-{1}.pdf", PC, UserCulture)) response.ContentType = "application/pdf" doc.Save(response.OutputStream)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You understood it correctly. Follow merely sets the starting point for the next conversion based on the previous HtmlToPdfResult.LastPosition. There is no easy way to have multiple sections with different number of columns on the same page. The closest you can have is to set HtmlToPdf.Options.OutputArea. For example, if you want to start a two column section from the middle of the page, you can set OutputArea to (left=1, top=5, width=6.5, height=4.5). However this would cause the same value to be applied on the second page as well.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
Thanks for your reply.
Unfortunately the solution you suggested would be not be suitable for this project as I do not want a top margin to be applied on the proceeding pages.
Are there not any other alternative solutions to this problem? I'm currently in the process of looking into trial versions of html to pdf libraries to be used with my business. This problem is a bit of deal breaker for me and my company so I may have to look into alternative solutions If I am unable to fix this using your product. I have looked into PDFreactor and they have a potential solution to this problem.
Would appreciate any more feedback you have as we would seriously look into the possibility of purchasing some developer licences if we get this solved.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
How many licenses will you be purchasing? I do not believe there is any way for you to do that in the current version (I don't think any other products on the market can do that either). However we do recognize that as a valid scenario so if you are willing to commit and working with us we can probably get this implemented for you.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
We would be looking at 3 licences. I'll have to speak with my manager about it first as it would be a big risk for us to commit to your product before we are properly assured that you will implement a solution for this scenario.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Of course. What I meant by "commit" I meant we may need your input/feedback on implementing this. Basically we need you to work together with us in order to get the best possible solution to you. It's more about technical collaboration than anything else. We will try to implement the core logic first, after that you can tell us whether the API we provide works for you or not.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
Ok thank you very much.
Let me know what you need from me.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
We will try to implement this and hopefully can get you a new build early next week for you to try it out. If there is any particular reason that we can not implement it, we will let you know as early as possible.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, We have posted a new build that implemented this feature. In the new build, after calling Follow (which set StartPosition based on the previous conversion result), you will need to call:
Code: C#
HtmlToPdf.Options.StartColumnIndex = -1;
This will cause StartPosition to be applied to all columns, not just the first column. Please let us know if this works for you. We will PM you the download location shortly. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
Hello,
Just updated my build and it has fixed my problem perfectly. I'm still testing your solution with a few projects but for now it has fixed the issue which I posted in here.
I'll update you tomorrow once I have finished my testing.
Thank you very much for your help!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Great. Thanks for confirming that it works for you. Please feel free to let us know if there is anything else.
|
|
Rank: Newbie Groups: Member
Joined: 8/10/2012 Posts: 7
|
Hi,
Just to clarify, everything seems to be working fine with your build.
Thanks again for your help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
You are very welcome. Glad to hear that it's working for you.
|
|