Product:Apryse SDK
Product Version:9.3
Please give a brief summary of your issue:
Write some text on the bottom of the page. But not on the pdf page content
Please describe your issue and provide steps to reproduce it:
I am able to add the extra space on the top of the page and write some text over there as branding. But I tried to add some extra space at the bottom of the page. But i could not add. Is there any way we can add space at the bottom of the page and add the text?
Code snippet that i used for adding the space at the top of the page is as follows:
private static void Brand()
{
PDFDoc doc = new PDFDoc(input_path);
doc.InitSecurityHandler();
int pageCount = doc.GetPageCount();
Page page = doc.GetPage(1);
Rect rect = page.GetMediaBox();
page.SetMediaBox(new Rect(rect.x1, rect.y1, rect.x2, rect.y2 + 20));
Rect cropBox = page.GetCropBox();
page.SetCropBox(new Rect(rect.x1, rect.y1, rect.x2, rect.y2 + 20));
Rect newrect = page.GetMediaBox();
page.SetMediaBox(new Rect(rect.x1, rect.y1, rect.x2, rect.y2 +100));
ElementBuilder builder = new ElementBuilder();
ElementWriter writer = new ElementWriter();
writer.Begin(page);
// Create a text element
Element textElement = builder.CreateTextBegin();
textElement.SetTextMatrix(1, 0, 0, 1, 0, 0); // Set text position
textElement.GetGState().SetFont(Font.Create(doc, Font.StandardType1Font.e_helvetica), 12); // Set font and size
textElement.GetGState().SetFillColor(new ColorPt(0, 0, 0)); // Set text color
textElement.GetGState().SetTextRenderMode(GState.TextRenderingMode.e_fill_text); // Set rendering mode
// Set the text content
string text = "Your branded text here";
//textElement.AppendText(text);
Element txtElement = builder.CreateTextRun(text);
double x = newrect.x2 - 200;
double y = newrect.y2 - 10;
Matrix2D matrix = new Matrix2D(1, 0, 0, 1, x, y);
txtElement.SetTextMatrix(matrix);
writer.WriteElement(txtElement);
Element textEnd = builder.CreateTextEnd();
writer.WriteElement(textEnd);
writer.End();
// Save the modified PDF document
doc.Save(output_path, SDFDoc.SaveOptions.e_linearized);
doc.Close();
}
Please provide a link to a minimal sample where the issue is reproducible:
I have added the screenshot where i have added the space at top of the page and written some text.