onaled777
asked on
IText showing string as blank in new document
Any ideas why this function would write a string to a document that cannot be seen?
the input file from which baos is created is smaller than the output file that is finally created from using this function. In addition if I select the text from both documents I can see the text difference in a tool like 'Beyond Campare'. so the text is there just not visible to my eyes. Any suggestions on what I could do to show it?
public static void addPageTimestampFooter(Byt eArrayOutp utStream baos) throws Exception {
PdfReader reader = new PdfReader(baos.toByteArray ());
PdfStamper stamper = new PdfStamper(reader, baos);
int numOfPages = reader.getNumberOfPages();
String timestamp = " - Printed: "+DateUtil.datetime2MM_dd_ yyyy_h_mm_ a(
new Timestamp(System.currentTi meMillis() ));
for (int i=1; i<=numOfPages; i++)
ColumnText.showTextAligned (
stamper.getUnderContent(i) ,
PdfContentByte.ALIGN_CENTE R,
new Phrase("Page "+i+timestamp),
reader.getPageSize(i).getW idth()/2,
5,
0);
stamper.close();
reader.close();
}
the input file from which baos is created is smaller than the output file that is finally created from using this function. In addition if I select the text from both documents I can see the text difference in a tool like 'Beyond Campare'. so the text is there just not visible to my eyes. Any suggestions on what I could do to show it?
public static void addPageTimestampFooter(Byt
PdfReader reader = new PdfReader(baos.toByteArray
PdfStamper stamper = new PdfStamper(reader, baos);
int numOfPages = reader.getNumberOfPages();
String timestamp = " - Printed: "+DateUtil.datetime2MM_dd_
new Timestamp(System.currentTi
for (int i=1; i<=numOfPages; i++)
ColumnText.showTextAligned
stamper.getUnderContent(i)
PdfContentByte.ALIGN_CENTE
new Phrase("Page "+i+timestamp),
reader.getPageSize(i).getW
5,
0);
stamper.close();
reader.close();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.