I am adding hidden text in pdf files to make them searchable. For some documents bottom left seems to be the default (0,0) where as for others it is top left. My understanding is that can because of page rotation.
In the code below I am getting/printing page rotation but that is showing up as 0 for different test pdf files I have. Any ideas why some documents would translate (0,0) to bottom left while other would go to top left.
File file = new File(inputDocumentName);
PDDocument document = PDDocument.load(file);
//Retrieving the pages of the document
PDPage page = document.getPage(0);
int rotation = page.getRotation();
System.out.println("Rotation: " + rotation);
contentStream.moveTo(0, 0);
//Begin the Content stream
contentStream.beginText();
//Setting the font to the Content stream
contentStream.setFont(PDType1Font.COURIER, 20);
contentStream.newLineAtOffset(0, 0);
//Adding text in the form of string
contentStream.showText(text);
//Ending the content stream
contentStream.endText();
//Closing the content stream
contentStream.close();
//Saving the document
document.save(new File(outputDocumentName));
//Closing the document
document.close();
Any ideas on how can I find which corner (0,0) represent in a pdf document. Thanks.