This html:
<div style="display: none">Hey</div>
When converted to PDF using iTextSharp and xmlworker is not hiding the div as it should, so the PDF ends up being a blank page with the text "Hey" in it.
Any workaround for hiding elements?
Note: They've removed the xmlworker tester they previously had in itextpdf.com
Note: I'm actually using a wrapper library called MvcRazorToPdf which uses iTextSharp and xmlworker
Related
I want to break page while converting HTML to PDF using iText 7.
<div style="page-break-after: always">content after this div will flow on the next page</div>
Or
<div style="page-break-before: always">this div will be started on a new page</div>
I am working on Pimcore. In CMS I have created a page and added block to render Html on page. The page is working but, I am facing a problem that the Html editor in CMS is removing <section> tags while saving the Html. I couldn't find the function where it is saving the html. Tried to do some trick in its js file by adding section in allowedContent object allowedContent:{"h1 h2 h3 h4 h5 h6 table ul ol blockquote div tr p div li td section":{propertiesOnly:!0,attributes:"dir"}}
but, It couldn't help it at all.
The Pimcore HTML Editor is the CKEditor. To keep sections in the editor, you'll need to modify the CKEditor and add the section widget:
https://ckeditor.com/cke4/addon/section
<style>
input[type="submit"]{background-color: red;}
.myButton{background-color: red;}
</style>
<input type="submit" value="Submit" class="myButton">
The input button is not getting the styling.
When converting HTML forms to interactive PDF forms the submit buttons use a standard style for PDF forms, they cannot use all styles you define in HTML document
There are a few solutions that I have seen but none of them worked for me. I am using Wicket 1.6
my wicket contains the following
WebMarkupContainer scriptLeaflet = new WebMarkupContainer("script_leaflet");
scriptLeaflet.add(new AttributeAppender("src", urlFor(new JavaScriptResourceReference(BasePage.class,"js/leaflet.js"), null).toString()));
add(scriptLeaflet);
my html contains the following
<script wicket:id="script_leaflet"></script>
I am using firefox's inspect element to check the content. I dont see any javascript in the rendered html page. If I replace the script tag with div tag just to see what happens I see the src url on the div tag as <div src="...."> but does not work when using the script tag
Consider the following code:
from xhtml2pdf import pisa
if __name__=="__main__":
source_HTML = """<html>
<body>
<a href="http://www.stackoverflow.com">
<img src="http://i.stack.imgur.com/uQFNA.png"/>
</a>
<a href="http://www.stackoverflow.com">
<p>Stackoverflow</p>
</a>
</body>
</html>"""
output_filename = "output.pdf"
# open output file for writing (truncated binary)
result_file = open(output_filename, "w+b")
# convert HTML to PDF
pisa.CreatePDF(
source_HTML,
dest=result_file)
result_file.close()
The html should render both an hyperlink image and a hyperlink text, but xhtml2pdf renders the image without the hyperlink and the text with the hyperlink. Is this an issue with the code above or a limitation/bug with the library? Thanks in advance for any help with the above issue.
I found a way to get this too work but it is not very good.
You can add a before and after the img inside the A tag. And then set the font-size on the A tag to be the height of the image and then also set text-decoration to none.
So like I said this works but is not a great solution. I searched issues on xhtml2pdf's github page and cannot find anyone else with this issue.