'Is it possible to write css directly inside html tags when convert pdf to html?
I'd like make script to edit pdf file, so the solution that I found is to convert pdf to html then edit the html content with WYSIWYG ckeditor and then convert it to pdf.
I'm using pdf2htmlEX to convert pdf to html, I have just tested it and the result of html is acceptable and not bad.
The problem is pdf2htmlEX generate the CSS inside <head></head> :
<head>
<style type="text/css">
.ws0{word-spacing:0.000000px;}
._8{margin-left:-1.248645px;}
._0{width:1.302673px;}
._5{width:196.786503px;}
._2{width:233.314181px;}
._4{width:234.658876px;}
._3{width:250.942892px;}
._1{width:280.862355px;}
._6{width:295.054890px;}
...........
</style>
</head>
<div class="c x1 y1 w2 h2">
<div class="t m0 x2 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">F A C<span class="_ _0"></span> T U R<span
class="_ _0"></span> E
</div>
<div class="t m0 x3 h4 y3 ff1 fs1 fc1 sc0 ls0 ws0">Désignat<span class="_ _0"></span>ion<span
class="_ _1"> </span>Quantité<span class="_ _2"> </span>Prix unit H<span
class="_ _0"></span>T<span class="_ _3"> </span>TVA<span class="_ _4"> </span>Total TTC
</div>
</div>
I'd like to ask if is it possible with pdf2htmlEX to write css directly inside html tags instead of writing css inside head tag ?
Because if the css is inside the head , it will not be acceptable in CKEditor.
with pdf2htmlEX --help , I didn't found a command to do that
Solution 1:[1]
This isn't possible I'm afraid. If you want to do this you will need to write something that post-processes the data, parses the CSS part and replaces each occurence of each class with an equivalent style string.
Depending on your use case it might just be easier to write something that edits the PDF directly using one of the many PDF libraries available. (iText, PDFBox etc)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | David Hedley |
