I am using FOP to tranform xml to pdf, and I need to use Chinese characters.I did do something to use Chinese font,but it seems don't work at all.
I create the font xml file.
and registered in the fop.xconf
<font metrics-url="/home/zhufree/Tools/fop-2.1/conf/simkai.xml" kerning="yes" embed-url="/home/zhufree/Tools/fop-2.1/conf/kaiti.ttf">
<font-triplet name="simkai" style="normal" weight="normal" />
<font-triplet name="simkai" style="normal" weight="bold" />
<font-triplet name="simkai" style="italic" weight="normal" />
<font-triplet name="simkai" style="italic" weight="bold" />
</font>
the font xml file and font ttf file are in the same directory with fop.xconf,when I try to transform,it still show me cant find the font.
What should I do to show the Chinese character?
Update:
I solved the problem by using specific configuration file in java code, and it worked well.Thanks.
Related
when I build a jar file an run it, i can't see the image.
In Eclipse it is working all good.
The Image should be a Button
<effect>
<ImageInput>
<source>
<Image url="file:./images/record_by_felickzs.PNG" />
</source>
</ImageInput>
</effect>
that is because on eclipse the image is not packed so it is accessible the way you are doing it, however when you export a jar file the image is packed and you can not access file inside the jar that way,,, use relative path instead:
<effect>
<ImageInput>
<source>
<Image url="#../../images/record_by_felickzs.PNG" />
</source>
</ImageInput>
</effect>
edit : replace PNG with png
I am trying to embed images in xml document and save the document as a single document and be able to distribute the file just like microsoft word where both the text and images are saved in single docx file.
How is it done in Microsoft word. Do they use base64 encoding ?
It is quite hard to do it by hand and would look something like that:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:p>
<w:r>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5943600" cy="3717290"/>
<wp:docPr id="1" name="Picture 0" descr="vlcsnap-325726.png"/>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
<pic:nvPicPr>
<pic:cNvPr id="0" name="myImage.png"/>
<pic:cNvPicPr/>
</pic:nvPicPr>
<pic:blipFill>
<a:blip r:embed="rId4"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</pic:blipFill>
<pic:spPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="5943600" cy="3717290"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</pic:spPr>
</pic:pic>
</a:graphicData>
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
</w:p>
</w:body>
</w:document>
You don't want to do it that way. I would recommend to use an external library like OpenXML SDK 2.0 (by Microsoft) or OpenXML4J (especially for Java). They will make your life way easier
I have this code in ZK, with a menu to navigate:
<zk apply="org.zkoss.bind.BindComposer"
viewModel="#id('vm') #init('menu')">
<tabbox width="100%" sclass="nav_tabs">
<tabs id="tabs">
<tab label="Admin" onSelect="updateCategory(self.label)"/>
<tab label="User" onSelect="updateCategory(self.label)"/>
</tabs>
<tabpanels>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="CreateUser" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="CreateMno" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="LoadData" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="DownloadData" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
</tabpanels>
</tabbox>
<separator height="30px"></separator>
<zscript><![CDATA[
void updateCategory(String category) {
current_category.setValue(category);
current_subpage.setValue("Index");
}
]]></zscript>
<hlayout>
<label id="current_category" sclass="nav_text nav_category" onClick="#command('submit')">Our Product</label>
<label sclass="nav_text">-</label>
<label id="current_subpage" sclass="nav_text">Index</label>
</hlayout>
</zk>
Then i have two roles Admin, and User, and i need load the pages of each user, and i am trying that when a user click in the toolbarbutton, for example CreateUser, then call a method that load in the space of my toolbar button the page, but i do not how can i do it.
Something like:
http://www.zkoss.org/zkdemo/tabbox/navigation_tabs
but i not need a string in Our product -> Product 1 - > Our Product-Product 1, i need load a page, and i am calling the page with the same name to the label.
And a page from a java class
Somebody can help me?
Please add the following to your tabpanel:
<include id="includeID" mode="instant" src="page.zul" />
Later on, you may load another page by adding the following to a zscript:
includeID.setSrc("another_page.zul");
My XSL style uses Arial font
<fo:block font-family="Arial" font-size="8pt" font-weight="normal">
Configuration file fonts.xml:
<?xml version="1.0"?>
<fop>
<renderers>
<renderer mime="application/pdf">
<fonts>
<base>file:///C:/windows/fonts</base>
</fonts>
</renderer>
</renderers>
</fop>
also tried using this:
<auto-detect/>
and
<directory>C:\windows\fonts</directory>
I am always getting:
WARNING: Font "Arial,normal,400" not found. Substituting with "any,normal,400".
What should I fix in order to use Arial font?
This worked for me, need to specify the Arial font explicitly in configuration file:
<?xml version="1.0"?>
<fop>
<renderers>
<renderer mime="application/pdf">
<fonts>
<font kerning="yes" embed-url="file:///C:/windows/fonts/arial.ttf">
<font-triplet name="Arial" style="normal" weight="normal"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
How can I set a default value in a ComboBox using FXML?
<ComboBox fx:id="cbo_Bacteriologie_Aesculine" prefHeight="21.0" prefWidth="105.0" GridPane.columnIndex="1" GridPane.rowIndex="0">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="NVT" />
<String fx:value="Bezig" />
<String fx:value="Positief" />
<String fx:value="Negatief" />
</FXCollections>
</items>
</ComboBox>
I want NVT to be selected by default. I tried adding selected="selected" and such but don't seem to find the right syntax.
Is it possible to edit the listed items using Scene Builder? I can't seem to find it.
Use this:
<ComboBox>
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="NVT" />
<String fx:value="Bezig" />
<String fx:value="Positief" />
<String fx:value="Negatief" />
</FXCollections>
</items>
<value>
<String fx:value="NVT" />
</value>
</ComboBox>
I don't think it's possible in the FXML. You will need to do it in the initialization of the component, in the controller, for example using the following line cbo_Bacteriologie_Aesculine.getSelectionModel().setSelectedIndex(1); for selecting the element Bezig.
But if you find a way to do it in FXML, I am interested.
EDIT : It is possible in FXML. You can see it in Guedolino's answer (https://stackoverflow.com/a/14436371/1344424), which should become the right answer to this question.
I got a strange error with the first suggested method
setSelectedItem(T) has protected access in SelectionModel
where T is a type-variable:
T extends Object declared in class SelectionModel
For me
getSelectionModel().select("NVT");
worked like a charm.