When using the HTMLWorker to covert HTML into PDF elements we can provide a StyleSheet instance that can be used to style the generated elements.
Unfortunately the CSS-to-PDF conversion is quite limited (it doesn't seem possible to indent a list for example) so I wondered if there is an equivalent iTextSharp "PDF Stylesheet" we can declare, which will be used when elements are written to the document?
Alternatively are there any events we can hook into in order to walk the element tree and apply our styles, before the document is written?
as documented on many places (especially on SO), HTMLWorker is deprecated in favor of XML Worker. XML Worker reads CSS from file, from the header, inline, etc... Read the documentation for more info about the Java version. For the C# version, take a look at the test apps.
Related
Whenever a part of a language label needs to be somehow highlighted, what is considered as best practice here?
I'm usually trying to avoid html tags in language labels as far as possible by splitting label into a parts and wrapping into corresponding tags in Fluid.
In worst case label is wrapped with CDATA:
<trans-unit id="my.label">
<source><![CDATA[Here comes a <strong>bold text</strong> and then <em>italic</em> and now <span class="fancy">fancy styled</span> stop]]></source>
</trans-unit>
But this mixes content and presentation, which can bring pain afterwards, when CSS is refactored and some classes are renamed.
Another solution, coming into my mind, is to move all the texts, that may contain html tags, out of XLF to either plugin's FlexForm RTE field or some configuration record with RTE fields. But it also looks rather like hack.
How do you solve such an issue usually?
For me there are some possible options, depending on the kind of text.
1.) Avoid HTML as much as possible
2.) If this HTML is wrapped around any arguments, move the HTML out and use it as argument for the <f:translate /> ViewHelper.
3.) Sometimes it is hard to use arguments as the translation is just different and I then use different partials/sections for the different languages and don't use any language file.
4.) I use the CDATA approach.
An addition to Georg Ringer's answer (whose point 1 is definitely the way to go, if at all possible):
5.) Use what XLIFF offers. XLIFF 1.2 has elements to mark tags inside translatable content - to be precise, it has too many such elements. One possible representation of your example would be
<trans-unit id="my.label">
<source>Here comes a <bpt id="1"><strong></bpt>bold text<ept id="1"></strong></ept> and then <bpt id="2"><em></bpt>italic<ept id="2"></em></ept> and now <bpt id="3"><span class="fancy"></bpt>fancy styled<ept id="3"><span></ept> stop</source>
</trans-unit>
This looks messy in code, but it has the advantage that an XLIFF aware translation editor will present this to your translators in a way that is easy for them to work with, like this:
.
The translator will be able to move these tags if the text order needs to be changed in the target language, and they can delete these purple tags in whole if they don't make sense in the target language: for example some complex Chinese characters look awful in bold face. They will not be able to delete parts of tags either.
One possible solution could be the use of parameters in the translation strings. Those parameters could be filled with translated strings which are wrapped in tags (by TS or fluid). This might result in a very complex translation handling as the strings are broken down to multiple strings (which might partially loose context).
Another solution could be the use of markers (like ###B### for <b>and ###_B### for </b>) for the tags which are replaced at the end (and which could vary for different devices). This also is complex and needs a good configuration and invents something like a further markup.
I'm wonderring whether Google is ready to publish (or there is at least any chance to "produce") the full formal xml schema for GWT UIBinder.
I've searched the latest entire GWT-SDK-2.4 distribution but found nothing. Does GWT simply look up java sources or reflect the classes of the widgets to validate the UIBinder xml counterparts, assuming that the xml schema was actually by no means predefined thus adopted to govern the validation?
#EDIT
According to the answer from #Ganesh Kumar, I've looked into ui.xsd (r6836) and found something e.g. in lines 496-499:
<!--
A complex type that contains both text and elements. There is no schema
for the elements, they can be any elements.
-->
There're also other similar occurrences indicating no schema for the elements alike. It seems that Google has not yet fully defined even agreed on the xml schema for UIBinder xml instances, doesn't it?
AFAIK, the XSD is only there to help the Google Plugin for Eclipse doe autocomplete.
There's no schema per se, UiBinder generator directly matches the elements with classes and the attributes with setters (with a few exceptions, such as addStyleNames, this is documented in the UIObject javadoc). There are a bunch of element parsers specific to some widgets (each widget that uses one has some specific documentation in its javadoc), and there are attribute parsers to unmarshal attribute values into Java objects to pass to setters.
Yes, Google is publishing the XSD for UiBinder as part of GWT source. You can get the latest GWT source which is available at http://google-web-toolkit.googlecode.com/svn/trunk/. You can view the XSD at here
I'm planning to use Mono.Addins in my C#/.NET project.
For that, I've read the Programming Guide and Reference Manual presented in codeplex.com, downloaded the latest version of source code from github.com, and successfully built all the samples included in the source package. However, whether the online documents or sample projects, all try to demonstrate how to extend an AddinHost by creating new instances of an ExtensionNode. There seems to miss something about how to retrieve and process data from the AddinHost.
For example, say I have a text editor, which processes RTF document, and I want to provide the possibility for addins to find/replace the document with its own way (For example, Regex / Forward / Backward / Whole document / Current Line...), so the addin need to get the content from AddinHost first. This is the question I need an answer for.
Any ideas?
If I understood well you have to maintain a reference to the RTF document, I think that providing it inside an initialization code for your plugin could be a way to obtain it.
Or you can have a sort of "IFindReplaceAddin" with a method, say "FindReplace", that accepts the RTF document as argument and returns the elaborated document.
I posted a question on the DOxygen forums and also am posting it here for a better response.
I have a moderately sized C project of about 2,900 functions. I am using DOxygen 1.5.9 and it is successfully generating a call graph for the functions. Is there a way to extract this out for further analysis? A simple paired list would be sufficient, e.g.
Caller,Callee
FunctionX, FunctionY
...
I am comfortable with XSLT but I must say that the DOxygen XML output is complex. Has anyone done this before and can provide some guidance on how to parse the XML files?
Thanks in advance!
Based on what I see in the contrived example that I created,
Parse files with a name similar to ^_(.+)\d+(c|cpp|h|hpp)\.xml$, if my regex-foo is right.
Find all <memberdef kind="function">. It has a unique id attribute. I believe the XPath for this is //memberdef[#kind='function'].
Within that element, find all <references>.
For each of those tags, the refid attribute uniquely refers to the id attribute of the corresponding <memberdef> that is being called.
The text node within each <references> corresponds to the <name> of the corresponding <memberdef> that is being called.
This seems like a nice, straightforward way to express call graphs. You should have no trouble using XSLT or any other sane XML-parsing suite to get the desired results.
My attorney gave me a 10 page contract that we need to fill in the blanks with the client name, pricing etc and then provide the client with a PDF or equivalent of the contract.
I have looked at PDF::Create but it looks like I would have to create the entire document through code, not just the the placeholders.
CAM::PDF, PDF::API2 can modify existing documents. Your question is not very specific, so no code example.
I would look into using a templating system and LaTeX rather than making the pdf by hand.