iTextSharp and ZUGFeRD Basic profile - itext

I am creating ZUGFeRD PDF files with iTextSharp 5.5.9 which works fine so far. The only thing which is currently not working is the setting with the Conformance-Level.
writer = PdfAWriter.GetInstance(document, New FileStream(strFilenameOut, FileMode.Create), PdfAConformanceLevel.ZUGFeRDBasic)
or
writer.SetPDFXConformance(PdfAConformanceLevel.ZUGFeRDBasic)
won't work for me. The Metadata contains %s instead of BASIC as shown in the screenshot below.
I guess that I missed something to set. Maybe someone had the same issue and can help me to solve this issue.
Regards
Jochen

ZUGFeRD is based on the PDF/A-3 standard. You are using a method to set PDF/X conformance. PDF/A and PDF/X are two very different standards. You shouldn't set the PDF/X conformance.
Please take a look at the official documentation. I have written a book about ZUGFeRD. You can download this book as an eBook if you fill out this form: http://pages.itextpdf.com/ZUGFeRD.html
For the Basic profile, you need to take a look at Chapter 5. There are many examples available online.
This is how it's done in Java:
PdfAWriter writer = PdfAWriter.getInstance(document,
new FileOutputStream(dest), PdfAConformanceLevel.ZUGFeRDBasic);
In C#, you'll have:
PdfAWriter writer = PdfAWriter.GetInstance(document,
New FileStream(strFilenameOut, FileMode.Create), PdfAConformanceLevel.ZUGFeRDBasic)
All the examples work in Java, but recently there was a problem detected with the C# port. Maybe you are experiencing the same problem. As far as I know, this problem has been fixed in the current development version.
If you are a customer, you should ask your account manager to get a hotfix that solves this problem.

Related

In SAPUI5, they provide samples for codes. How to actually use those?

I just started using SAPUI5 and I am actually curious on how the samples work.
For example:
https://sapui5.hana.ondemand.com/#/entity/sap.f.FlexibleColumnLayout/sample/sap.f.sample.FlexibleColumnLayoutColumnResize
I downloaded it and opened using Atom IDE. However, I don`t see any mock data or .json.
Is that on purpose? I was actually expecting to see the code for the sample, with the sample data.
Thank you very much.
The data gets loaded from https://sapui5.hana.ondemand.com/test-resources/sap/f/demokit/sample/FlexibleColumnLayoutColumnResize/webapp/data/sections.json
see line 21 in Component.js: var oProductsModel = new JSONModel("./data/sections.json");
You can find details on how to set up a JSON model in Step 7 of SAPUI5 Walkthrough - a tutorial with all major UI5 development paradigms.

Read modules from web.config in autofac to change container configuration according to solution configurations

I have created some Autofac modules... Now I want to register some of them in my container using web.config... In my web.config I have written:
<autofac defaultAssembly="Autofac.Example">
<modules>
<module type="DebugModuleTest1"></module>
<module type="DebugModuleTest2"></module>
</modules>
</autofac>
Now I have to build my container. But the autofac documentation is not clear to me. I do not understand what I have to do to read my modules and build the container.
public class MyCustomContainer
{
public void Build(HttpConfiguration config)
{
var builder = new ContainerBuilder();
Microsoft.Extensions.Configuration.ConfigurationBuilder x = new Microsoft.Extensions.Configuration.ConfigurationBuilder();
//var sec = x.AddInMemoryCollection().Build().GetSection("autofac");
// var y = x.AddXmlFile("Web.config");
var y = new ConfigurationBuilder().SetBasePath(AppDomain.CurrentDomain.BaseDirectory);
var z = y.AddXmlFile("Web.Config");
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
}
}
I am using latest version of Autofac so I do not have the ConfigurationSettingsReader class available.
Can anyone help me please?
EDIT
I had found interesting saving configuration on web.config because in this way I could "change" web.config according to my solution configuration (you know, the classic web.debug.config, web.release.config, etc)...
That could me help to register the correct modules avoiding the use of directives (#if bla bla bla, ...) or simply conditions...
I am already using modules, but I do not think the correct solution is adding a property inside the module to choose the component to resolve according the selected environment where I want to deploy the project..
I just think of this solution reading this example (By the way, Flexibility to Override still refers to ConfigurationSettingsReader. Is it ok?)
In the 4.0 version of configuration you don't store anything in web.config. It's all in separate XML or JSON files. I'd recommend JSON. The documentation outlines that pretty well:
If you were using the app.config or web.config based configuration available before, you will need to migrate your configuration to the new format and update the way you set configuration with your application container.
We actually spent a lot of time trying to document as much as possible, so while there's definitely a lot there try not to "TL;DR" it. If you skip around, you're liable to end up in the "pre 4.0" section thinking that will still work with the 4.0 stuff. It won't. It sounds like from your comment on this other question that you may have missed a few things the first time through.
Spend some time in the quick start section. That section has both C# and JSON code showing how things work. Again, it's easy to skip past that.
If the docs don't show enough examples, look at the unit tests in the Autofac.Configuration repo, especially the folder full of test files that shows both XML and JSON formatted examples we use in testing.
Finally... three tips:
Configuration is not a feature-for-feature replacement for code. If you're looking to do amazing, crazy, logic-based stuff then stick to modules, possibly with some configuration to register the modules.
Be familiar with Autofac and DI terminology. If you're new to DI or Autofac, "components," "services," and other terms will be confusing. The configuration uses these terms, which means you may not get what you're looking at. Spend time with the docs. The getting started page includes an intro to some of the terminology.
Learn about the new Microsoft config system. There is separate doc about that maintained by Microsoft. Their docs explain everything from how to change config based on environment to creating custom config providers. Autofac is standing on the shoulders of config giants - we don't have to build in that flexibility anymore because it comes for free from the new config system.

How can i use XFAFlattener from iText in jruby?

I got inspiration from https://github.com/abevoelker/pdf_ravager to create XFA Flattening. I was trying to use the XFAWorker, which is a paid version. I am trying to get the trial version to work with jRuby. XFAFlattener cannot be instantiated since it says that the class cannot be found. I added the license key as well. I am doing all the experiment in jirb.
I am assuming i dont understand how license key works. Any suggestions will be great.

node-mongodb-native example code vs docs code? which to use?

I just wrote my first nodejs program using the node-mongodb-native driver. I used the documentation code from the github page, i.e.:
var mongodb = require("mongodb"),
mongoserver = new mongodb.Server('localhost', 6574),
dbConnector = new mongodb.Db('test', mongoserver);
dbConnector.open(function(err, db){
if(err)
console.log('oh shit! connector.open error!');
else{
...
However, upon looking at some example code on the github page, I discovered that the set up code looks very different from what I used. Does anybody know if there's any real difference between the different methods? I'm completely new to all this stuff and can't really tell if there's any reason to use one over the other. The code I wrote seems to run fine, but if the creator of the driver is using different code, I figured it would be worth checking if there are any reasons for that.
Thanks in advance for any replies!
Sami
Hi I'm the creator and no there is no particular reason you can't use your style. As when it comes to docs I usually tell people to start with the integration tests as there are many examples on how to do stuff. Unfortunately due to having a fulltime job the docs are not kept up to date at the pace I would like to.
I'm hoping to do something with that come late september but right now I'm trying to just get the driver up to the expected features of mongodb including making it work with 1.9.X and higher.
I'll accept any docs pull requests happily as the more the community help me the more it helps itself :)

Flash XFL to iOS/XCODE/Interfacebuilder

I am thinking of starting an ambitious project of writing some type of converter to convert the new Flash CS5 XFL format to some type of iOS readable format for building pages. A lot of what I do convert old Flash course over to native applications. They are usually very simple with some basic animations. Some are more complicated than others, obviously.
1) I recently found the XFL format and was wondering if anyone was doing this type of conversion?
2) Has adobe published this file specs yet? I haven't been able to find them, yet.
3) Is this even possible? Has anyone tried and been unsuccessful or would like to work together on this?
I thought of this and wonder if it is a good idea that we insert the code directly in the flash file. That means the tool is written in ActionScript, for example a utility class called SceneExporter. When you want to export a MovieClip, extends it with SceneExporter and when the Flash file runs, it exports the content of that MovieClip to a objective C code text file. Not professional way, but it should work since we have access to all child elements of that MovieClip.