Button not displayed while converting html to pdf

While converting html to pdf buttons are not visible

Hi


Thank you for contacting support. Please provide us your source HTML document and sample code in this forum thread. We’ll investigate it and reply you accordingly.

Hi,

I am attaching the sample html code as a file. Below is the code, I used to convert html to pdf

HtmlLoadOptions htmloptions = new HtmlLoadOptions();
// Load HTML file
Document doc = new Document(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(html)), htmloptions);
doc.Flatten();
doc.PageLayout = PageLayout.SinglePage;
doc.FitWindow = false;
doc.Save(“output.pdf”);

Hi,

Sorry, I was not able to see any buttons in your HTML after opening it in different browsers (Internet Explorer, Firefox and Chrome etc.) and MS Word. Can you please share a screenshot to display which buttons/area you are referring to?

Please also share a PDF to show your expected output if possible.

Best Regards,

Hi,

Sorry, Please try the html provided now. I have also placed the screenshot of button how it opens in browser and attached samplepdf generated. I have added one test button to test whether buttons are displayed or not. The actual buttons are the Employers table update buttons.

I have also found another issue.
The issue is select dropdownlist is showing first option instead of blank as selected even though blank is selected.

Hi Rakesh,


Thanks for contacting support.

I have tested the HTML to PDF conversion using Aspose.Pdf for .NET but have observed that shared HTML (sample2.txt) is not similar to resultant samplepdf.pdf file, as it contains lots of extra \n and \r delimiters. Can you please double check at your end and again share the resource HTML.

PS, when using same HTML, the formatting of this file is also not correct when viewing it inside Web browser.

Hi,

That is the exact html as string I used for creating samplepdf. I also tried by removing \r and \n, but it didn’t worked. Does \r and \n effect the display of button. And also please update me about the select dropdown issue

Hi Rakesh,


Thanks for sharing the details.

The reasons I mentioned \n and \r is that formatting of input HTML is disturbed and similar formatting is also ported in resultant PDF. For the sake of testing , I have removed these delimiters from in HTML and have performed HTML to PDF conversion using Aspose.Pdf for .NET 10.6.0 and have managed to reproduce that buttons are not being rendered in PDF file. For
the sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-39113. We
will investigate this issue in details and will keep you updated on the status
of a correction.

Besides this, I am unable to notice the drop down related issue as Drop-downs appear blank for drop-downs with blank selection. For your reference, I have also attached the resultant PDF generated over my end.
<o:p></o:p>

Hi,

In the Pdf you produced we can’t see text on the buttons. We only seeing colour related to the button and they are not visible correctly. I am placing sample html which has blank values for select dropdown. In the previous html sample all dropdowns were selected may be thats why you are not able to reproduce the issue, you can test the sample html for the select dropdown blank issue.

Hi Rakesh,


Thanks for sharing the details.

I have again tested the scenario using latest HTML file which you have shared and I am unable to notice value selection in drop-down when rendering the output as PDF format. For your reference, I have also attached the resultant file generated over my end.

[C#]

Document document = new Document(@“C:\pdftest\selectissuesample.html”, new HtmlLoadOptions());<o:p></o:p>

document.Flatten();

document.PageLayout = PageLayout.SinglePage;

document.FitWindow = false;

document.Save(“c:/pdftest/selectissuesample_Issue.pdf”);

The issues you have found earlier (filed as PDFNET-39113) have been fixed in Aspose.PDF for .NET 22.6.