HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › Looking For PD4ML.NET Serve side Header/Footer Display Code
- This topic has 15 replies, 2 voices, and was last updated Mar 04, 2011
15:58:25 by PD4ML.
-
AuthorPosts
-
February 15, 2011 at 20:58#26518
Hello PD4ML.NET Support Team,
I did use the Java sample and tried to display page header and footers in PDF generated using an URL. I did created a Generic approach to use it through out my project and Sending the Responses back to the PDF posted page. I did my best to show the headers/Footers in the generated PDF file and failed. Can you please provide me a Sample code which deals with page headers and footers using .NET?
I have attached the sample Code files I did use at my End.
Thanks and Regards,
VAFebruary 16, 2011 at 16:11#28408Couldn’t find a place to attach the documents….
February 16, 2011 at 18:32#28409First, get familiar with 3 ways to define of headers/footers:
html-pdf-faq-f1/pdf-page-headers-footers-definition-options-t41.htmlPlease take into account, that some of the methods work with PD4ML Pro only.
I’ve just added Java samples there: C# .NET code should be more-less identical. Let us know if there are still open questions.
February 16, 2011 at 18:40#28410It is not working that way, As I need to the same from service. All you have provided me in the same is doable from Client side. I did check the link you have provided before I post my question.
I have a Generic page which takes page URL as a parameter and produce the pdf.
I will call the Generate PDF method from a page where there is no client side coding is not possible.Thanks
VAFebruary 16, 2011 at 18:51#28411As I wrote, there are some new Java samples there since few minutes ago.
OK, PD4ML.NET has PD4Converter.aspx.cs sample, which also takes URL as an parameter.
You need to add to the sample a section like
[language=java:9g47w3hd]PD4PageMark footer = new PD4PageMark();
footer.setPageNumberTemplate(“page $[page] of $[total]”);
footer.setTitleAlignment(PD4PageMark.LEFT_ALIGN);
footer.setPageNumberAlignment(PD4PageMark.RIGHT_ALIGN);
footer.setInitialPageNumber(1);
footer.setPagesToSkip(1);
footer.setFontSize(14);
footer.setAreaHeight(18);
pd4ml.setPageFooter(footer);[/language:9g47w3hd]
before
[language=java:9g47w3hd]pd4ml.render(new Uri(inputUrl), outfile);[/language:9g47w3hd]February 16, 2011 at 19:47#28412Thank you for your response.
When I do the same as you guided, I am getting below error
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 174.143.96.38:80Public Sub generatePDF(ByVal inputUrl As String, ByVal htmlWidth As Integer, ByVal pageFormat As String, ByVal permissions As Integer, ByVal bookmarks As String, ByVal orientation As String, ByVal insets As String, ByVal fontsDir As String, ByVal outfile As Stream)<br /> <br /> System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")<br /> System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture<br /> <br /> Dim pd4ml As New PD4ML()<br /> If (insets IsNot Nothing) Then<br /> Dim st As Tokenizer = New Tokenizer(insets, ",")<br /> Try<br /> Dim top As Integer = Int32.Parse(st.NextToken())<br /> Dim left As Integer = Int32.Parse(st.NextToken())<br /> Dim bottom As Integer = Int32.Parse(st.NextToken())<br /> Dim right As Integer = Int32.Parse(st.NextToken())<br /> Dim units As String = st.NextToken()<br /> Dim ins As Rectangle = New Rectangle(top, left, bottom, right)<br /> <br /> If ("MM".Equals(units.ToUpper())) Then<br /> pd4ml.PageInsetsMM = (ins)<br /> Else<br /> pd4ml.PageInsets = (ins)<br /> End If<br /> <br /> Catch ex As Exception<br /> Throw New Exception("Invalid page insets (top, left, bottom, right, units): " & insets)<br /> End Try<br /> End If<br /> <br /> pd4ml.HtmlWidth = (htmlWidth)<br /> If (orientation Is Nothing) Then<br /> orientation = "portrait"<br /> End If<br /> <br /> If ("PORTRAIT".Equals(orientation.ToUpper())) Then<br /> pd4ml.PageSize = PD4Constants.getSizeByName(pageFormat)<br /> Else<br /> pd4ml.PageSize = pd4ml.changePageOrientation(PD4Constants.getSizeByName(pageFormat))<br /> End If<br /> <br /> If (permissions <> -1) Then<br /> pd4ml.setPermissions("empty", permissions, True)<br /> End If<br /> <br /> If (bookmarks <> Nothing) Then<br /> If ("ANCHORS".Equals(bookmarks.ToUpper())) Then<br /> pd4ml.generateOutlines(False)<br /> ElseIf ("HEADINGS".Equals(bookmarks.ToUpper())) Then<br /> pd4ml.generateOutlines(True)<br /> End If<br /> End If<br /> <br /> If (fontsDir <> Nothing AndAlso fontsDir.Length > 0) Then<br /> pd4ml.useTTF(fontsDir, True)<br /> End If<br /> <br /> Dim footer As New PD4PageMark()<br /> footer.setPageNumberTemplate("page $[page] of $[total]")<br /> footer.TitleAlignment = PD4PageMark.LEFT_ALIGN<br /> footer.PageNumberAlignment = PD4PageMark.RIGHT_ALIGN<br /> footer.InitialPageNumber = 1<br /> footer.PagesToSkip = 1<br /> footer.FontSize = 14<br /> footer.AreaHeight = 100<br /> pd4ml.PageFooter = footer<br /> <br /> 'pd4ml.render(New Uri(inputUrl), outfile)<br /> 'pd4ml.render(New Uri(inputUrl).AbsoluteUri, outfile)<br /> pd4ml.render(inputUrl, outfile)<br /> <br /> End Sub
I appreciate your further support in this regard.
Thanks
VAFebruary 16, 2011 at 19:51#28413The message tells your application cannot establish a direct HTTP connection with the host. Are you behind a firewall? Don’t you need to define proxy settings?
February 16, 2011 at 20:55#28414Nope. It used to work before I added the footer code you have provided me. Thank you.
February 17, 2011 at 14:09#28415If I remove the footer code which is above the render page, the link is working as is. It is not giving me any error details.
All the code currently I am using in my application is posted in one of my previous posts.
Thank you
VAFebruary 21, 2011 at 15:17#28416There is a new PD4ML.NET version available for download. Please check if it solves the issue.
March 3, 2011 at 16:42#28417@PD4ML wrote:
There is a new PD4ML.NET version available for download. Please check if it solves the issue.
The newer .NET version did not help me with anything. I do see the same problem.
I couldn’t able to display the Header and footer using PD4ML.NET.I need to do this ASAP. Please run a sample in .NET and try to mimic this issue at your end. The current process is taking too much of time and did not solve the issue since long with our discussions.
I really appreciate if you can consider this an prioritized issue and provide me .NET specific sample with headers, footers, page breaks and some content in it.
Thanks and Regards,
VAMarch 4, 2011 at 11:45#28418> A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 174.143.96.38:80
Is the PD4ML-enabled application running also on 174.143.96.38?
March 4, 2011 at 14:11#28419@PD4ML wrote:
> A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 174.143.96.38:80
Is the PD4ML-enabled application running also on 174.143.96.38?
I am able to generate the PDF but no header, footers or page breaks even though I did convert the same java code you have provided and tried.
Please help me to include the missing parts in the current report i am generating.
Thanks and Regards,
VAMarch 4, 2011 at 15:05#28420I cannot help you in a case you do not answer my questions.
March 4, 2011 at 15:32#28421@PD4ML wrote:
I cannot help you in a case you do not answer my questions.
Yes…is the answer.
Will it be easy to talk in live please…instead of spending time in chatting please?
If needed I can share my environment and show you what i am doping.I am under the gun to resolve all the issue and demo it to my end users.
Hope you can understand my current situation.
Thanks and Regards.
Va -
AuthorPosts
The forum ‘General questions / FAQ’ is closed to new topics and replies.