Hi,
I am trying to add a transparent text over(overlapping) a picture. However, I used the setHorizontalAlignment(100) function from Graph object but it did not set the text to where i wanted. Can you help me with it?
The code is below.
int alpha = 10;
int green = 0;
int red = 100;
int blue = 0;
// create Document instance
// Document doc = new Document();
// create page to pages collection of PDF file
// Page page = doc.getPages().add();
Page page = doc.getPages().get_Item(1);
// create Graph object
Graph canvas = new Graph(100, 400);
// create rectangle instance with certain dimensions
// Rectangle rect = new Rectangle(10, 100, 400, 400);
// create color object from Alpha color channel
// rect.getGraphInfo().setFillColor(Color.fromArgb(alpha, red, green, blue));
// add rectanlge to shapes collection of Graph object
// canvas.getShapes().add(rect);
// add graph object to paragraphs collection of page object
page.getParagraphs().add(canvas);
// set value to not change position for graph object
canvas.setChangePosition(true);
canvas.setHorizontalAlignment(100);
canvas.setVerticalAlignment(670);
// canvas.setTop(value);
canvas.setZIndex(10);
// create TextFragment instance with sample value
TextFragment text = new TextFragment(“pic of google logo”);
// create color object from Alpha channel
Color color = Color.getBlack();
// set color information for text instance
text.getTextState().setForegroundColor(color);
// add text to paragraphs collection of page instance
page.getParagraphs().add(text);
// save PDF file
doc.save(“Transparent_Text.pdf”);