For the problem of print timestamps the only solution I tested is via
embedded postscript commands. Look at the attached example.
This example does not work on destiller 6.0 but works on suitable printers.
It prints a printer identification and the current date and time.
Best regards,
Carsten Hammer
bruno schrieb:
It's a bad idea to send mail to my personal address.
If every iText user did this, I wouldn't have a life.
Razal, Jocel [SFOKA] wrote:
Hi Bruno,
We have a project wehre we wanted to put watermarks to existing pdf
files. However, the watermarks must only be displayed when printing
the pdf file.
I think you would have to add it as an annotation.
I should check if this is possible.
Also , we wanted to put the current timestamp when the pdf file is
printed. Does your library support this?
I don't know if this is possible with any product.
If I had to look for a solution, I would search Adobe's JavaScript
Reference. Maybe you could add a readonly text field that is
only visible when the document is printed and that is filled with
the current date and time in a print event.
Anyway. These are just suggestions. I can't give you a concreet answer.
br,
Bruno
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
import java.io.*;
import com.lowagie.text.pdf.*;
import com.lowagie.text.*;
import java.awt.Color;
public class identifyembps {
static String psscript = "/Helvetica findfont 15 scalefont setfont\n" +
"10 10 moveto\n" +
"product show\n" +
"( ) show\n" +
"version show\n" +
"mark\n" +
"(\n)\n" +
"revision 10 mod\n" +
"revision 100 mod 10 idiv (.)\n" +
"revision 100 idiv\n" +
"(Revision: )\n" +
"(\n)\n" +
"counttomark\n" +
"{ 17 string cvs show\n" +
"} repeat pop\n" +
"( ) show\n" +
"(%Calendar%) currentdevparams\n" +
"/Day get 9 string cvs show\n" +
"(.) show\n" +
"(%Calendar%) currentdevparams \n" +
"/Month get 9 string cvs show\n" +
"(.) show \n" +
"(%Calendar%) currentdevparams \n" +
"/Year get 9 string cvs show\n" +
"( ) show \n" +
"(%Calendar%) currentdevparams \n" +
"/Hour get 9 string cvs show\n" +
"(%Calendar%) currentdevparams \n" +
"(:) show \n" +
"/Minute get 9 string cvs show\n" +
"(%Calendar%) currentdevparams \n" +
"( ) show \n" +
"/Second get 9 string cvs show\n" +
//"showpage\n"+
"";
public static void main(String[] args) {
// step 1: creation of a document-object
Document document = new Document();
try {
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream(
"identify.pdf"));
BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI,
BaseFont.NOT_EMBEDDED);
writer.setPdfVersion(writer.VERSION_1_3);
document.compress = false;
// step 3: we open the document
document.open();
// step 4: we grab the ContentByte and do some stuff with it
PdfContentByte cbpre = writer.getDirectContentUnder();
PdfPSXObject psxobjectidentificationandtimestamp = new PdfPSXObject(writer);
psxobjectidentificationandtimestamp.setLiteral(psscript);
cbpre.addPSXObject(psxobjectidentificationandtimestamp);
String text = " Some text to show";
document.add(new Paragraph("Page1" + text,
new Font(Font.HELVETICA, 28, Font.BOLD)));
}
catch (Exception de) {
de.printStackTrace();
}
// step 5: we close the document
document.close();
}
}