Add PNG to .jasper file on runtime - jasper-reports

I was tasked with making an aplication that adds PNG of peoples signatures to some documents, so every time someone uploads a signatre to the system the aplication adds that PNG to the PDF that gets renderen in the .jasper file.
I am being given 5 .jasper files which are the documents that need the signature to be added to them, but reading about Jasper the .jasper files are the compiled forms of the documents and if I want to modify them in any way I need the .jrxml files.
Do I need to ask for the jrxml files? or is it possible to add the signatures in run time to the PDF by having the aplication interact with the .jasper file?
I believe that at the very least, the function that triggers the PDF rendering should recive a PNG of the signature in order to add it to the PDF, meaning the .jasper file should already have a parameter where the PNG would be loaded into already set up them, so that way I would not have to modify the .jasper file and I would just call the function that renders and pass the PNG though it.
If that is the case how could I verify that the .jasper file has this parameter set up already?

I would add the signatures dynamically in the jrxml file like:
<image>
<reportElement x="96" y="42" width="50" height="50" uuid="eda533e7-0d2f-4df0-8ef1-b3cce6a63936"/>
<imageExpression><![CDATA["pic_"+$V{PAGE_NUMBER}+".jpg"]]></imageExpression>
</image>
so the right picture will be chosen on the fly. For sure you have to change the jrxml files one time. But afterwards this is only a configuration task. Think you add the name below the signature as well. So you should have a method to dynamically create text out of the base data.

Related

Set filename to ditamap title in DITA-OT Command Line PDF transformation

I have a script that builds a system on a regular schedule, and as part of that system, I need to convert several documents from dita to PDF.
I can run the following shaped command line from my script fine:
dita --input=<file location> --output=<output location> --format=pdf
But due to naming conventions and other restrictions, the name of the ditamap files are not always well-formed or human-readable (and I am not able to change the name of the files). I'm aware of the outputBase.file parameter that I can pass in on the command line, but I would like dita to be able to scan/read the file and substitute the document title as the filename, something along the lines of:
dita --input=<file> --output=<output> --format=pdf --outputBase.file=$title
Is this even possible?
You don't have to change dita command-line formats. Instead, you can change output PDF file name to the document title according to following steps:
In the top of the your PDF plug-in processing, read the main map's title (bookmap or map) using XSLT task and output XML file that contains title.
Set the title to some property you prefer (such as document.title). To set property, it is useful to use <xmlproperty> task in ant script.
After generating PDF file, change the PDF file name in <output location> to ${document.title}.pdf in the last phase of build process.
In my experience, one of the user want to output PDF that is authored in bookmap. In this case, above technique works fine for this user.
Hope this helps your development.

merging PDFs with Ghostscipt ignoring outline and using pdfmark instead

I am using a Batch script to merge different PDFs in one complete file.
%gsc% -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dEPSFitPage -o %dsk%%zus%%ext% %mfd% %pth%tmp\pdfmarks
%dsk%%zus%%ext%: Path and name of final (complete) document
%mfd%: Path and name of docs to be merged (c:\test\1.pdf c:\test\2.pdf ...)
%pth%tmp = path to the pdfmarks file
Additionally, I am creating a pdfmark document inside the script which gs uses to create the bookmarks. But unfortunately, some of the docs I am merging, have already their own bookmarks and I did not yet find a solution how to ignore those. GS should only use the bookmarks inside the pdfmarks file.
How can this be done?
Firstly; you are not 'merging' PDF files when you use Ghotscript's pdfwrite device. The process is described in detail here
The important point is that the way the input file(s) are constructed has no bearing on the way the output file is constructed. If any other software you use relies on the file being constructed in a particular fashion it may not work on the output PDF file.
The -dEPSFitPage switch only has any effect when the input is an EPS file. If you want to 'fit' PostScript or PDF files then you need to use -dPDFFitPage, -dPSFitPage or just -dFitPage. However, all of these rely on you first selecting a media size, and then preventing it being altered by setting -dFIXEDMEDIA. For EPS files you would more normally use -dEPSCrop which sets the media size to the EPS declared BoundingBox.
You can prevent the PDF interpreter reading the Outlines tree (which you are calling Bookmarks) and then creating a pdfmark from it to pass to the pdfwrite device by using the -dNO_PDFMARK_OUTLINES switch which oddly isn't documented, presumably an oversight.

Doxygen-produced PDF - change url color?

I’m using Doxygen 1.8.10 (on Windows) to generate LaTeX files, and MiKTex 2.9 to generate a PDF. The PDF is functional, but not very pretty. I’ve figured out how to customize the title page (I added graphics and non-default text) and how to get the images into the PDF.
But... how do I change the styling for things such as the color of URLs (which are just text in the Doxygen comments, and then Doxygen turns them into \href items)?
**** I believe I need to change something in the hyperref package’s config or what Doxygen writes to the .tex files, but I’m not sure which approach is right, nor how to do either one...
I’ve created a custom_doxygen.sty file, and assigned it to the LATEX_EXTRA_STYLESHEET. I assume that it’s being picked up by Doxygen because Doxygen is successfully picking up my custom LATEX_HEADER file, which is in the same directory as the custom_doxygen.sty file. But what I don’t know is what to put into the custom_doxygen.sty file?
If I run everything as default (that is, no LATEX_EXTRA_STYLESHEET), the following code gets written to the refman.tex file:
% Hyperlinks (required, but should be loaded last)
\usepackage{ifpdf}
\ifpdf
\usepackage[pdftex,pagebackref=true]{hyperref}
\else
\usepackage[ps2pdf,pagebackref=true]{hyperref}
\fi
\hypersetup{%
colorlinks=true,%
linkcolor=blue,%
citecolor=blue,%
unicode%
}
And what I need is for the “urlcolor” to also be blue (its default in the hyperref package is magenta—an odd choice for sure).
I tried just basically copying what was in the refman.tex file to the custom_doxygen.sty file (and making sure that the custom_doxygen.sty file is assigned to the LATEX_EXTRA_STYLESHEET setting in my Doxyfile) and adding a “urlcolor=blue,%” to the setup section, but there’s no change in the output.
If I manually edit the refman.tex file (that is, I add "citecolor=blue,%" to the \hypersetup) after it's output from Doxygen, and then use the edited file as input to MiKTeX, I get the desired output.
So a workaround could be to just script the desired change and run the script every time. But it would be certainly be better to get Doxygen to write the necessary configuration. Plus, there are other things I want to customize (such as the font of explicit html hrefs), so I'd like to learn how to do things properly.

Extracting file names from an online data server in Matlab

I am trying to write a script that will allow me to download numerous (1000s) of data files from a data server (e.g, http://hydro1.sci.gsfc.nasa.gov/thredds/catalog/GLDAS_NOAH10SUBP_3H/2011/345/). Unfortunately, the names of the files in each directory are not formatted in a similar way (the time that they were created were appended to the end of the file name). I need to be able to specify the file name to subset the data (I have a special tool for these data types) and download it. I cannot find a function in matlab that will extract the file names.
I have looked at URLREAD, but it downloads everything including html code.
Thanks for your help!
You can easily parse the link.
x=urlread(url)
links=regexp(x,'<a href=''([^>]+)''>','tokens')
Reads every link, you have to filter all unwanted links.
For example this gets all grb files:
a=regexp(x,'<a href=''([^>]+.grb)''>','tokens')

Create Excel file in iPhone programmatically

I want to create a Excel supported file which contains strings and images programmatically. I tried to create a .csv file, but I am not able to .csv file with both string and image.
There are many possibilities. The easiest way is to create CSV-Files but you have to take care which seperators excel uses. For checking that you should create a spreadsheet in excel and save it as csv and take a look into that file using any text-editor.
Another approach is to use SpreadsheetML and here a link to the msdn XML Spreadsheet Reference
Otherwise just create a simple xlsx-file with excel, unzip that file and take a look into that the unziped files.