Cannot convert SVG file to PDF file use apache batik - java

I have a lot of SVG files that needed to be converted into PDF files. When I call Batik from console, I get the following error;
~\batik-1.10>java -jar batik-rasterizer-1.10.jar -d "D:/PDF" -m application/pdf
-dpi 1200 -w 9921 -h 14031 "D:/SVG/topic*.svg"
> About to transcode 1 SVG file(s)
> Converting d:/SVG/topic*.svg to D:\PDF\topic*.pdf ... ... error (SVGConverter.error.cannot.open.source)
> org.apache.batik.apps.rasterizer.SVGConverterException: Error: cannot open source topic*.svg java.io.IOException: Unable to make sense of URL for connection
at org.apache.batik.apps.rasterizer.SVGConverter.transcode(SVGConverter.java:968)
at org.apache.batik.apps.rasterizer.SVGConverter.execute(SVGConverter.java:717)
at org.apache.batik.apps.rasterizer.Main.execute(Main.java:937)
at org.apache.batik.apps.rasterizer.Main.main(Main.java:990)
What is the problem here?

I was able to recreate your problem (getting the IOException with message "Unable to make sense of URL for connection"), using your command as listed.
I think in this case, the easiest thing to do would be to eliminate the use of quotes on your source directory path, and execute the following:
java -jar batik-rasterizer-1.10.jar -d "D:/PDF" -m application/pdf -dpi 1200 -w 9921 -h 14031 D:/SVG/topic*.svg

Related

highchart-export-server --batch command running but not converting json into png

I have installed highcharts export server using command - npm install highcharts-export-server -g (v2.1.0)
and I have node of latest version - v14.17.3.
Now I have created a JSON file and to convert this into png file I am running the command -
highcharts-export-server -batch "C:\apps\sdplatform\reports\blitz-qa3\pod-5e4d8ede0c832d6279ff7dc6_61162655777300.json=C:\apps\sdplatform\reports\blitz-qa3\pod-5e4d8ede0c832d6279ff7dc6_61162655777300.png"
at location C:\apps\sdplatform\reports\blitz-qa3 json file 5e4d8ede0c832d6279ff7dc6_61162655777300.json is-
{"chart":{"type":"column","options3d":{"alpha":15,"beta":25,"depth":60,"enabled":true},"inverted":false,"polar":false,"styledMode":false},"title":{"text":"Chart Title 2","align":"left"},"credits":{"enabled":false,"text":""},"xAxis":[{"categories":["Adoption","Growth","Renewal","Inactive"],"labels":{"step":0}}],"yAxis":[{"title":{"text":"Count","align":"left"},"allowDecimals":false,"startOnTick":false,"endOnTick":true,"reversed":false}],"plotOptions":{"series":{"stacking":"","point":{"events":{"click":function(e){if(typeof this.url != 'undefined') { window.location = this.url;}}}},"dataLabels":{"enabled":true,"color":"","formatter":function () {return ' '+this.y+'<br>';},"softConnector":false,"allowOverlap":false},"cursor":"pointer"}},"series":[{"name":"MRR","type":"column","data":[{"y":376500.0,"url":"/entityobjects?filter_as_pod=5e4d8ede0c832d6279ff7dc6&filter_stage=adoption__c&entity=Customer&filter_as_pod_series_0=5e4d8ede0c832d6279ff7dc6&filter_mrr__gt=0","info":"Adoption"},{"y":29500.0,"url":"/entityobjects?filter_as_pod=5e4d8ede0c832d6279ff7dc6&filter_stage=Growth&entity=Customer&filter_as_pod_series_0=5e4d8ede0c832d6279ff7dc6&filter_mrr__gt=0","info":"Growth"},{"y":318616.0,"url":"/entityobjects?filter_as_pod=5e4d8ede0c832d6279ff7dc6&filter_stage=Renewal&entity=Customer&filter_as_pod_series_0=5e4d8ede0c832d6279ff7dc6&filter_mrr__gt=0","info":"Renewal"},{"y":127000.0,"url":"/entityobjects?filter_as_pod=5e4d8ede0c832d6279ff7dc6&filter_stage=inactive__c&entity=Customer&filter_as_pod_series_0=5e4d8ede0c832d6279ff7dc6&filter_mrr__gt=0","info":"Inactive"}]}],"exporting":{"enabled":false}}
after running the above --batch command in cmd I am expecting the chart image pod-5e4d8ede0c832d6279ff7dc6_61162655777300.png will get generated at C:\apps\sdplatform\reports\blitz-qa3 location but In actual nothing is happening no any .png file generated there.
how can I get the chart png here?
Once the server is properly installed and started, you can try these basic commands:
https://github.com/highcharts/node-export-server#command-line-arguments
highcharts-export-server --infile <file_name>.json --outfile <file_name>.<file_type> --type <file_type>
highcharts-export-server --infile ./_examples/basic.json --outfile ./_examples/basic.png --type png

CF pushing - the system cannot find the file specified

I am using cf for the first time, trying to deploy a simple app to Bluemix. When I try cf push, I get this error:
E:\Program Files\tomcat\apache-tomcat-8.0.41\webapps\helloServletMaven\target
λ cf push /helloServletMaven -p /helloServletMaven.war
Creating app /helloServletMaven in org alexander.kirwan / space ORG as alexander.kirwan#mycit.ie...
OK
Using route helloservletmaven.mybluemix.net
Binding helloservletmaven.mybluemix.net to /helloServletMaven...
OK
FAILED
Error processing app files: GetFileAttributesEx E:\helloServletMaven.war: The system cannot find the file specified.
E:\Program Files\tomcat\apache-tomcat-8.0.41\webapps\helloServletMaven\target
λ ls
classes/ generated-sources/ helloServletMaven/ helloServletMaven.war m2e-wtp/ maven-archiver/ maven-status/ test-classes/
E:\Program Files\tomcat\apache-tomcat-8.0.41\webapps\helloServletMaven\target
But as you can see, when I run ls, I do have the war file.
Why is this happening?
By the way, I am using Windows and CMDER for the console.
It looks like your file is in the local directory so you don't have use /helloServletMaven.war, i.e. remove the slash (/)
cf push helloServletMaven -p helloServletMaven.war

Using wsimport from windows - url = http://www.webservicex.net/geoipservice.asmx?WSDL

I get this error when I used the URL
http://www.webservicex.net/geoipservice.asmx?WSDL
C:\Program Files (x86)\Java\jdk1.6.0_18\bin>wsimport **<URL>**
parsing WSDL...
[WARNING] Ignoring SOAP port "GeoIPServiceSoap12": it uses non-standard SOAP 1.2
binding.
You must specify the "-extension" option to use this binding.
line 197 of **<URL>**
[WARNING] ignoring port "GeoIPServiceHttpGet": no SOAP address specified. try ru
nning wsimport with -extension switch.
line 200 of **<URL>**
[WARNING] ignoring port "GeoIPServiceHttpPost": no SOAP address specified. try r
unning wsimport with -extension switch.
line 203 of **<URL>**
generating code...
**[ERROR] .\net\webservicex\GeoIP.java (The system cannot find the path specified)**
C:\Program Files (x86)\Java\jdk1.6.0_18\bin>
This error suggests the compiler needs GeoIP.java in order to progress - which should (technically) be given by your WSDL. I had this error, and it was because I did not have permissions to write to the directory (in this case, you're writing to C:\Program Files (x86)\Java\jdk1.6.0_18\bin - simple test would just be to try and run mkdir TEST in this directory) so GeoIP (for example) could not be written.
Specify a directory using the -d switch or change your working directory to one where you have permissions.
This error is coming because of permission issue.
C:\Program Files\Java\jdk1.8.0_65\bin> mkdir test
Access is denied.
Try using another directory to place generated files.
wsimport [options] < WSDL_URL > -d <directory>
specifies where to place generated output files
E:\sei is the directory, i am using to place output class files.
C:\Program Files\Java\jdk1.8.0_65\bin> wsimport -d E:\sei http://www.webservicex.net/geoipservice.asmx?wsdl
In case http://www.webservicex.net/geoipservice.asmx?WSDL is not responding, use http://wsgeoip.lavasoft.com/ipservice.asmx?WSDL instead.

Send xml file using curl script

I'm trying to insert data to my local DB using a XML file. Actually I did it using postman client in chrome, I put the XML definition and I gave my service URL send it by POST and in work fine.
Now I'm trying to do it with curl commandline, this is the line that I'm using:
curl -F "file=#/Users/Jonathan/Documents;filename=variable.xml" 127.0,0.1:8080/WU-BDP-MetadataManagement/v1/variables
Where file# is the path to my XML file and variable.xml is my file name next to my service URL but this is not working.
Some advice of what im doing wrong?
Regards!
You are using the whole directory instead of file /Users/Jonathan/Documents and it should be something like /Users/Jonathan/Documents/variable.xml
So your overall command will be
curl -F "file=#/Users/Jonathan/Documents/variable.xml;filename=variable.xml" 127.0,0.1:8080/WU-BDP-MetadataManagement/v1/variables

stanford parse bash script error - linux bash

Can someone help me check my bash script? i'm trying to feed a directory of .txt files to the stanford parser (http://nlp.stanford.edu/software/pos-tagger-faq.shtml) but i can't get it to work. i'm working on ubuntu 10.10
the loop is working and reading the right files with:
#!/bin/bash -x
cd $HOME/path/to
for file in 'dir -d *'
do
# $HOME/chinesesegmenter-2006-05-11/segment.sh ctb $file UTF-8
echo $file
done
but with
#!/bin/bash -x
cd $HOME/yoursing/sentseg_zh
for file in 'dir -d *'
do
# echo $file
$HOME/chinesesegmenter-2006-05-11/segment.sh ctb $file UTF-8
done
i'm getting this error:
alvas#ikoma:~/chinesesegmenter-2006-05-11$ bash segchi.sh
Standard: CTB
File: dir
Encoding: -d
-------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/nlp/ie/crf/CRFClassifier
Caused by: java.lang.ClassNotFoundException: edu.stanford.nlp.ie.crf.CRFClassifier
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: edu.stanford.nlp.ie.crf.CRFClassifier. Program will exit.
the following command works:
~/chinesesegmenter-2006-05-11/segment.sh ctb ~/path/to/input.txt UTF-8
and output this
alvas#ikoma:~/chinesesegmenter-2006-05-11$ ./segment.sh ctb ~/path/to/input.txt UTF-8
Standard: CTB
File: /home/alvas/path/to/input.txt
Encoding: UTF-8
-------------------------------
Loading classifier from data/ctb.gz...done [1.5 sec].
Using ChineseSegmenterFeatureFactory
Reading data using CTBSegDocumentReader
Sequence tagging 7 documents
如果 您 在 新加坡 只 能 前往 一 间 俱乐部 , 祖卡 酒吧 必然 是 您 的 不二 选择 。
作为 或许 是 新加坡 唯一 一 家 国际 知名 的 夜店 , 祖卡 既 是 一 个 公共 机构 , 也 是 狮城 年轻人 选择 进行 成人 礼等 庆祝 的 不二场所 。
As well as the : (colon), which should be a ; or a new line, the 'dir -d *' doesn't do what you think it does - the loop will just have one iteration, where file is a long string beginning with dir -d and with all your files afterwards. Also, you initially change to a path based on $file but then reuse the variable file in your loop, which is suspect. I'm having to guess somewhat about your intent, but it can be much simpler, e.g.:
#!/bin/bash
cd ~/path/to/whereever
for file in *
do
~/chinesesegmenter-2006-05-11/segment.sh ctb "$file" UTF-8
done
Even if you used the (more correct) version with backticks:
for file in `dir -d *`
... it would still qualify for a Useless Use of ls * Award ;)
Update: originally I forgot to quote $file, as pointed out in another answer
You could try:
for file in *
do
$HOME/segment.sh ctb "$file" UTF-8
done
So there were a couple of things to correct:
Don't use : after the for statement, use ; or a newline
Put quotation marks around the "$file" object to allow whitespaces in file name
If you want to use a command where you put 'dir -d *' you should use $(dir -d *) or angle quation marks instead ``
for file in 'dir -d *': do
You've put a colon instead of a semicolon.
If you want an easy debugging, you can add -x as an option to your shebang :
#!/bin/bash -x
The errors will be easier to spot.

Categories

Resources