Docx4J - ImportXHTML - Sample code Not running properly - docx4j

I am looking to use Docx4j, specifically to convert html pages to word documents, so I was playing around with it, but I am unable to get the sample code in the git repo to work.
XHTML URL to word doc specifically is what is causing me issues. When I run the code, I obtain a mass of errors when converting, such as
[http-bio-8080-exec-10] ERROR run.FontSize - TODO FontSize Handle units: 2
as well as other errors relating to getColWidth for col1, among other things. When it finally crashes, I get a nullPointerExeption
#
line 974 | traverse in org.docx4j.convert.in.xhtml.XHTMLImporterImpl
which is if (listHelper.peekListStack().getElement()!=null
&& listHelper.peekListStack().getElement().getAttribute("class")!=null)
Are there any configuration changes I need to make to get the XHTMLImporter working out of the box?
I am using it from this Maven Repo, and this seems to be the most up to date version.
Docx4j seems to be working fine by itself, as I have successfully created and written to a docx file, but this issue seems to be plugin-specific. Any ideas on what is happening?

For the NPE, please lodge a bug report at https://github.com/plutext/docx4j-ImportXHTML/issues?state=open including a simple test case so it can be reproduced.
To work around your font size issue, you'll need to use a supported font size unit. See https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/model/properties/run/FontSize.java

Related

rioxarray.open_rasterio() not recognizing .hdf files

Apologies if this has been asked before. I tried to find an answer elsewhere, but couldn't find a response that resolved my issue.
I inherited some code for downloading and processing satellite data without a lot of explanation and I am required to make it work. The intention was that this code should run without me needing to do anything but run the script, but there is a bug that prevents it from working properly.
I've been able to narrow the issue to (probably) one line of code:
ds = rioxarray.open_rasterio(tempFile).compute()
where tempFile represents a string for an s3 bucket. The exception message I receive about it is as follows: '/MOD13Q1_A2022193_h09v04_061_2022215010516.hdf' not recognized as a supported file format
I have almost no experience with xarray and rasterio, so I don't have a good idea of where to begin to resolve this. The file does exist at the location and rasterio can process .hdf files (I think), but if that's the case, what may be going on here? Any help is appreciated.
Thanks!

404 When Trying to implement Utils in Power BI Custom Visual

I've run into this problem several times when trying to import external libraries to run with a Power BI custom visual, and I'm not really sure what I'm doing wrong. This current attempt is recreating the Card Visual in the latest API, and it's been a painstaking effort that hopefully someone else can help me out with. I can't point at any one reason why this is happening though it appears to be caused by using statements like:
import valueFormatter = powerbi.extensibility.utils.formatting.valueFormatter;
and I get error, in the browser:
Unable to get property 'valueFormatter' of undefined or null reference
visualSandboxMinimal.html (626,17)
when I tried removing these things I instead run into the error:
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(XHR)GET - https://app.powerbi.com/13.0.3328.205/visual.js.map;
I can't really resolve either of these errors, to make the project work. The project will build fine and display in the application, but not show any information. Something isn't setup with the API or the project where it just doesn't put the pieces together properly or something. I really don't know and there's so little information out there about this thing, that it's kind of like shouting in the dark at this point.
I am including the whole source project, hopefully so that anyone who can help will be able to, and if anyone wants to take my effort and build their own "Card" like Power BI visual: https://www.dropbox.com/s/9ks8u0v56eph8ul/cardWithConditionalFormatting.zip?dl=0 . This is based on the source available at https://github.com/Microsoft/PowerBI-visuals-core, specifically related to the Card visual.
If anyone figures this out, it would be a huge help to me, though I will continue to do my own research and if I find anything about it I will update the information here.
I figured out what was happening here, I had included the index.d.ts files in the tsconfig.json file, but forgot to include the index.js files in the pbiviz.json file and in some cases forgot to include the css files in the .less file.

main.worker.js? What's that?

I am building a PDF viewer in Ionic 2 using the Mozilla PDF Viewer but have run into a problem. I have built pdf.js in accordance with these instructions. The code generated includes this line:
var worker = new Worker(workerSrc);
Chrome is complaining on this line that it cannot find the file GET http://localhost:8100/build/main.worker.js.
Now then, I have not come across web workers before, so I'm not sure what this error means or where to find, or build, this file. I notice that the build process also yields a file called pdf.worker.js, and I have strong suspicions that this might be the file it's after, although renaming it to main.worker.js had no effect.
I'm sure this is a very simple problem if you are in the know. What am I missing?
Ok, after a little more digging, I found this which pertains more to my situation. I am using Ionic 2 and I don't know how to generate the file referenced in this line:
pdfjsLib.PDFJS.workerSrc = '../../build/webpack/pdf.worker.bundle.js';
Can anyone illuminate my dark mind?

Disable URL encoding of the query string in qtkwebit

I'm using qtwebkit to build a DOM-XSS scanner. By default qtwebkit is automatically URL encoding/escaping the query part of the URL. Javascript gets the URL encoded.
For example, when you visit the URL
http://test.com/?param=value<b>value</b>&a=b
location.href will contain the value
http://test.com/?param=value%3Cb%3Evalue%3C/b%3E&a=b
This is a big problem for me in detecting DOM-XSS vulnerabilities because I don't know if the browser did the encoding or the webpage did it. I'm trying to disable this functionality but I'm lost in the qtwebkit source code.
Anybody can help me by telling me where exactly in the code (in what file) the URL encoding takes place so I can modify the source code and recompile it?
I've been browsing the source code for 3 days now and I didn't make any progress.
Thank you very much in advance for any help.
I have also encounter your problem on Qt5,but Qt4 don't has this problem.
I modified Qt source code "qurlrecode.cpp" 's static function recode
This solved my problem, but I think it is best to modify webkit source code on KURL, but I failed to build webkit on my machine successfully after wasting one whole day.
QURL.setEncodedUrl(const QByteArray & encodedUrl) can solve it
via..http://doc.qt.io/qt-4.8/qurl.html#setEncodedUrl

CasperJS not finding file that is clearly there

This actually originally generated from a problem I was having running SpookyJS, but managed to nail it down to a problem with the underlying CasperJS (and based on another stackoverflow question I was directed to, possibly even a PhantomJS problem).
We determined that the command CasperJS was failing on was:
casperjs C:\wwwroot\dra\node_modules\spooky\lib\bootstrap.js --spooky_lib=C:\wwwroot\dra\node_modules\spooky\lib\ --command=casperjs --port=8081 --transport=stdio
Which generates the following:
{"jsonrpc":"2.0","method":"emit","params":["error","CasperError: CasperJS couldn't find module C:\\wwwroot\\dra\\node_modules\\spooky\\lib\\bootstrap\\stdio-server",[{"file":"C:\\casperjs\\n1k0-casperjs-bc0da16\\batchbin\\..\\bin\\bootstrap.js","line":133,"function":"_require"},{"file":"C:\\wwwroot\\dra\\node_modules\\spooky\\lib\\bootstrap.js","line":34,"function":""}]]}
At first I thought the fact that it was generating double slashes was an issue, but I've since learned that that's simply the way it spits it out. It simply can't find the file. I've tried to reference the file a few different ways, but to no avail. And, yes, the file is most definitely there. It's looking for stdio-server.js which is exactly where it's looking for it. It's also not specific to this file. In the course of my testing, I commented out that line and it failed three lines later, in the same fashion, looking for a different file.
I'm using:
CasperJS 1.0.2
PhantomJS 1.9.0
I'm desperate to get this working (preferably today since I have to demo it to my boss), so if anyone has any input on this I'd be MOST appreciative!
Thank you.
You should be able to fix this by upgrading PhantomJS to 1.9.1
Here are links to the CasperJS issue and the PhantomJS issue regarding this problem.