Forums

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Merger for Java (v4.x)  /  Avoid the overlapping of stamped text with text inside the PDF

Forum Thread - Avoid the overlapping of stamped text with text inside the PDF

Hello,

I want to know -  is there any way we can avoid through coding the overlapping of the stamped text with the original text present inside the PDF ?
This happens mostly in the PDFs created from the presentation files.

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
MergeDocument document = new MergeDocument("C:\\Temp\\Input.pdf");
 
// 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(0).getElements().add(new Label("This text is beneath the rectangle.", 0, 0, 200, 12));
 
// Add the transparency group to the page
page(0).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
Even after using the above code, still I'm facing the same issue. Please help me to resolve the same.
Posted by a ceTe Software moderator
Hello,

Can you please send over the following details to our support team so that they can look into it further?

1.Exact version of the DynamicPDF product which you are using.
2.Sample code which you are using to add text with transparency.
3.Input and out PDF document.
4.More details about what you would like to achieve using our DynamicPDF products.

Thanks,
ceTe Software Support Team.
I'm using DynamicPDF v7.0.1 (Demo).

My requirement is if I add a new text as Header/Footer(Right Center Left) in the existing PDF document,it should not overlap the existing PDF content in case if the exisiting text is very close to Header/Footer area. Automatically it should adjust the text and show the content without any overlapping.

Code below:
MergeDocument document = new MergeDocument(@"C:\Sample.pdf");
         // Create a transparency group and add a rectangle to it
         TransparencyGroup group = new TransparencyGroup(0.5f);
         group.Add(new ceTe.DynamicPDF.PageElements.Rectangle(50, 0, 100, 100, RgbColor.Red, RgbColor.Red));
         foreach (Page page in document.Pages)
         {
            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("TOP Left Text", 0, 0, 512, 12));
            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("TOP Center Text", 300, 0, 512, 12));
            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("TOP Right Text", 500, 0, 512, 12));

            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Bottom Left Text", 10, 770, 512, 12));
            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Bottom Center Text", 250, 770, 512, 12));
            page.Elements.Add(new ceTe.DynamicPDF.PageElements.Label("Bottom Right Text", 500, 770, 512, 12));

            page.Elements.Add(group);
         }
         //Page page = document.Pages[0];
         // Add the transparency group to the page
          
         document.Draw(@"C:\MyDocument.pdf");


I have not seen any option to attach the sample files...
Posted by a ceTe Software moderator
Hello,

It is not possible to move the contents of an already existing PDF document using any of DynamicPDF products. The new contents will be added to the PDF at the specified X and Y positions without modifying the already existing contents.

Thanks,
ceTe Software Support Team.
Ok Thanks for your updates.

Kindly let me know the objective of this forum topic "Avoid the overlapping of stamped text with text inside the PDF"
Posted by a ceTe Software moderator
Hello,

Stamping PDF document with some text is nothing but adding contents to the PDF document by setting some desired transparency to it so that the already existing contents are visible(for example adding watermark to the PDF). It will not move the contents of an already existing PDF.

Thanks,
ceTe Software Support Team.
Thanks for your updates..

All times are US Eastern Standard time. The time now is 6:57 PM.