Question

I have a pdf file with different pages that I'm trying to merge into ONE PDF page. So this list of pages are merged together and numbered. For example :

1. Page1
2. Page2

till all the separate pages are numbered and merged into one whole document.

the PROBLEM here is, that the numbers appear bottom aligned. I cannot get the numbers to appear at the top of the text.

enter image description here


Here is the snippet

 canvas.addTemplate(page, 1f, 0 , 0, 1, 100, pos);
canvas.beginText();
canvas.setTextMatrix(90, (float) ((pos)-0.5*CurPsize));
canvas.showText(m+"."+" ");
canvas.endText();

where , m=1 // number of pages counter initialized at 1

Rectangle r=reader.getPageSize(m)

CurPsize=(r.getTop()-r.getBottom());

pos=pos-CurPsize

.

I have attached the pdf file here. https://drive.google.com/file/d/0B4scqcWd2Ci0X1JpSi15Q1FkVDQ/edit?usp=sharing

This is the file I want to merge with numbering

Was it helpful?

Solution

I would suggest you to take a more mathematical approach to it, find the height of the image by using getTop()-getBottom().

Then , you should shift the images down by that amount of height Downwards. This will ensure that it is aligned properly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top