Wrapping of the stamped text without overlapping with the original PDF text

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for Java (v4)  /  Re: Wrapping of the stamped text without overlapping with the original PDF text

DynamicPDF Merger for Java (v4) Forum

Hello,

How to do the word wrapping of the stamped text without overlapping it with the original text inside the PDF ?

Thanks.
Posted by a ceTe Software moderator
Hello,

You can add text on top of existing text without having any kind of overlapping by using the sample code below:

// Create a PDF Document
Document document = new Document();
 
// Create a Page and add it to the document
Page page = new Page();
document.getPages().add(page);
 
// Create a transparency group and add a rectangle to it
TransparencyGroup group = new TransparencyGroup(0.5f);
group.add(new Rectangle( 50, 0, 100, 100, RgbColor.getRed(), RgbColor.getRed()));
 
// Add a label to the page
page.getElements().add(new Label("This text is beneath the rectangle.", 0, 0, 200, 12));
 
// Add the transparency group to the page
page.getElements().add(group);

It is by adding the Label page element to the TransparencyGroup page element and setting the transparency using the alpha parameter in the constructor of the TransparencyGroup.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 8:09 AM.