Is it possible to use two or more repeating groups (not nestead) on same page in PDF template. BI Publisher - pdf-generation

fProcessor.process() method stuck when PDF template with two repeating groups on same page is used.
Is it possible to use two or more repeating groups (not nested) on same page?
FormProcessor fProcessor = new FormProcessor();
fProcessor.setTemplate(args[0]); // Input File (PDF) name
fProcessor.setData(args[1]); // Input XML data file name
fProcessor.setOutput(args[2]); // Output File (PDF) name
fProcessor.process();

Received following reply from oracle support
PDF templates do not support multiple nor nested loops.
You can only use one.

Related

Gatsby: How to display a list of images specified in a yaml file?

I use the current version of Gatsby (2.x) and want to use gatsby-image for rendering a gallery for products.
I have several YAML files for products. I can already create pages with the text content of these files but I also want to add a small gallery with images specified in the .yaml file.
An example YAML file looks like this:
product: "Some product"
description: "It is really awesome!"
screenshots:
- /img/product1/screenshot1.jpg
- /img/product1/screenshot2.jpg
- /img/product1/screenshot3.jpg
My problem now is that I can get the screenshots only as strings but I have no idea how to pass them to for rendering.
I thought of creating a component that takes the file name and uses a query to get the image data - but it can't take any parameters because it can only use static queries.
I've also not found a way to pass results from the first graphql query to a second for the image data.
If you install gatsby-transformer-sharp and gatsby-plugin-sharp and use a correct path to your images, Gatsby will automatically pick those up and pipe them through sharp, hence you can query those images. You can have a look at one of my sites which also uses a YML file with image paths that I then use with gatsby-image: https://github.com/LekoArts/gatsby-starter-portfolio/blob/master/src/sites/sites.yaml

How do I train one model for OpenNLP Name Entity from multiple files in DKPro Core?

How do I train one model from multiple files in DKPro Core?
After annotate many documents in WebAnno and export in XMI format I tryed to create a model with this code:
File model = new File("/tmp/", "model.bin");
SimplePipeline.runPipeline(CollectionReaderFactory.createReaderDescription(XmiReader.class,
ResourceCollectionReaderBase.PARAM_SOURCE_LOCATION, "/tmp/",
ResourceCollectionReaderBase.PARAM_PATTERNS, ResourceCollectionReaderBase.INCLUDE_PREFIX + "*.xmi"),
AnalysisEngineFactory.createEngineDescription(OpenNlpNamedEntityRecognizerTrainer.class,
OpenNlpNamedEntityRecognizerTrainer.PARAM_TARGET_LOCATION, model,
OpenNlpNamedEntityRecognizerTrainer.PARAM_LANGUAGE, "pt"));
}
The problem is that although it did open the multiple annotated files only one file was trained.
The reader opens all files and sends them one-by-one to the trainer. The trainer learns from all of them and produces a single output model. That is why you only see one output file.
If you wanted to create one model per input file, you'd have to create a loop which passes the files one-by-one to the reader.

Add posts to Jekyll index page, without .md files

I would like to write a generator plugin to add some post-like items to my blog. The items are supposed to appear in the blog index, but they have no page associated to them (you can't click on them).
I know I need something like
class QuoteGenerator < Generator
safe true
def generate(site)
# add a single post
site.posts << QuotePost.new(site, site.source, "Blub")
end
end
But what I don't understand is how to implement my Post subclass. I've found that other plugins (like this one to embed Flickr photos) write the data they want to a markdown+YAML file, and then reference this file:
class QuotePost < Post
def initialize(site, base, title)
# Nooo, I don't want to create a .md file for this
name = "2016-05-13-test.md"
dir = ""
# (write out .md file here)
super(site, base, dir, name)
end
end
But then, I would hardly need a Plugin in the first place. I could just generate the markdown files myself (with an external script).
What I'd like to do is to just set a couple of variables in my Post subclass, and have them available in the template for the blog index. How can I do that?
The case you've described looks to be unrelated to Post, since usual posts are file-based. Collections may be suitable, but again - that's not clear how you getting the content.
I'd suggest two major options:
Use _data/ to set an object list, where each item has the required properties if you can define them via a static JSON/CSV/etc file (or generate it once, to separate external data producer and jekyll visualization).
Use :pre_render hook and a plugin if you have to define the data via code -
your hook will also receive a payload hash as a second parameter which allows you full control over the variables that are available while rendering
Having your data in site.data variable allows you to iterate through items, render something or include a template and so on. Also there are plugins which generate new pages based on site's data.
The right answer depends on how you're getting the content, which markup you need and how those items will be used.

What is the relationship between CGPDFContext and CGPDFDocument?

My understanding of this was that perhaps CGPDFContext is to be used for editing PDF document data and CGPDFDocument is used for storing it, since the documentation doesn't list any ways to alter the content of a CGPDFDocument.
I'm also not quite sure what CGDataConsumer/Provider does. From reading the documentation I got the impression that the consumer/provider abstracts the relationship between the CG object and the CFData it writes to; so I don't have to do that myself. So I figured the following code would create a two page blank PDFdocument:
//Don't know exactly how large a PDF is so I gave it 1 MB for now
self->pdfData = CFDataCreateMutable(kCFAllocatorDefault, 1024);
self->consumerRef = CGDataConsumerCreateWithCFData(self->pdfData);
self.pdfRef = CGPDFContextCreate(self->consumerRef, NULL, NULL);
CGPDFContextBeginPage(self.pdfRef, NULL); //Creates a blank page?
CGPDFContextEndPage(self.pdfRef);
CGPDFContextBeginPage(self.pdfRef, NULL); //Creates a second blank page?
CGPDFContextEndPage(self.pdfRef);
//Copies the data from pdfRef's consumer into docRef's provider?
self.docRef = CGPDFDocumentCreateWithProvider(
CGDataProviderCreateWithCFData(
CFDataCreateCopy(kCFAllocatorDefault, self->pdfData)
));
It didn't work though, and NSLogging the first two pages of docRef returns NULL. I'm rather new at this, the C-Layer stuff in particular. Can someone explain to me the relationship between CGPDFContext, CGPDFDocument, CGDataConsumer & CGDataProvider and how I'd use them to create a blank PDF?
Your basic understanding is correct as far as I can see:
A CGPDFContext is a drawing context that "translates" everything that is drawn onto it to PDF instructions (typically for storage in a PDF file).
A CGPDFDocument is used to open an existing PDF file and get information from it.
When you want to create your own PDF file, you have two ways to do it as described here: https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/CGPDFContext/Reference/reference.html
Use "CGPDFContextCreate" which you pass a data consumer. The data consumer gets the data and can do with it as it pleases (you could create a data consumer that passes the PDF onto the clipboard for example).
Use "CGPDFContextCreateWithURL" which you pass a URL. In that case your data will be written to a PDF file at that URL.
If you want to use these functions, have a look at this page https://developer.apple.com/library/mac/documentation/graphicsimaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF101 which explains in detail how to create PDF files with a data provider and without (simply to a PDF).
To figure out what is happening I would start by trying to write a simple PDF file to disk before writing one to a data provider and then using that data provider immediately to read it again. Without trying your code however, let me point out that you didn't use "CGPDFContextClose" which is described in the document as closing the PDF document and flushing all information to output. You could actually having a situation where stuff is cached and not written to your data provider yet, simply because you haven't forced that.

Create two documents with TCPDF

I am generating long PDF document with TCPDF.
What I want is to create two versions of this document - one with all pages and one with only 5 pages.
But when I call Output whole document is destroyed and I cannot call Output once again - how to create another document?
Solved problem - I've made instance of Object
$short_pdf= clone $this;

Resources