hi friends,
Hi,
//open
document<o:p></o:p>
com.aspose.pdf.facades.PdfFileStamp fileStamp = new com.aspose.pdf.facades.PdfFileStamp();
fileStamp.bindPdf("c:/pdftest/SpecialCharacters_test2.pdf");
//get total number of pages
int totalPages = new com.aspose.pdf.facades.PdfFileInfo("c:/pdftest/SpecialCharacters_test2.pdf").getNumberOfPages();
//create formatted text for page number
com.aspose.pdf.facades.FormattedText formattedText = new com.aspose.pdf.facades.FormattedText("Page # Of " + totalPages, java.awt.Color.BLUE, java.awt.Color.GRAY, com.aspose.pdf.facades.FontStyle.Courier, com.aspose.pdf.facades.EncodingType.Winansi, false, 14);
//set starting number for first page; you might want to start from 2 or more
fileStamp.setStartingNumber(1);
//add page number
// fileStamp.addPageNumber(formattedText, 0);
com.aspose.pdf.facades.Stamp stamp = new com.aspose.pdf.facades.Stamp();
stamp.bindLogo(formattedText);
stamp.setRotation(45f);
fileStamp.addStamp(stamp);
//save updated PDF file
fileStamp.save("c:/pdftest/Stamped_45_Degree.pdf");
fileStamp.close();
hi,
Hi there,
Document pdfDocument
= new Document(myDir
- “helloworld.pdf”);<o:p></o:p>
//create image stamp
ImageStamp imageStamp = new ImageStamp(myDir + "aspose_pdf.jpg");
imageStamp.setBackground(true);
imageStamp.setXIndent(100);
imageStamp.setYIndent(100);
imageStamp.setHeight(300);
imageStamp.setWidth(300);
//imageStamp.setRotate(Rotation.on270);
imageStamp.setRotateAngle(45);
imageStamp.setOpacity(0.5);
imageStamp.setStampId(421);
//add stamp to particular page
pdfDocument.getPages().get_Item(1).addStamp(imageStamp);
//save output document
pdfDocument.save(myDir + "ImageStamp_output45.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
hi Ahmed,
Hi,
hi nayyer.
Hi Chit,
com.aspose.pdf.facades.Stamp stamp = new
com.aspose.pdf.facades.Stamp();<o:p></o:p>
stamp.bindLogo(formattedText);
float f = Float.parseFloat("60");
stamp.setRotation(f);
fileStamp.addStamp(stamp);
hi tilal. thank you. i sent you email with my code
Hi Chit,
Hi Chit,
Hi Chit,
ArrayList watermark = new ArrayList<>();<o:p></o:p>
watermark.add("Test Line 1");
watermark.add("Test Line 2");
watermark.add("Test Line 3");
Document pdfDocument = new Document();
pdfDocument.getPages().add();
ArrayList textStamps = new ArrayList<>();
// arrange muliline text stamp text
FormattedText ft = new FormattedText(watermark.get(0), java.awt.Color.LIGHT_GRAY,
"Helvetica", EncodingType.Winansi, false, 80);
for (int i=1; i<watermark.size(); i++) {
ft.addNewLineText(watermark.get(i));
}
TextStamp stamp = new TextStamp(ft);
stamp.setBackground(true);
stamp.setOpacity(0.5);
stamp.setRotateAngle(-45);
stamp.setTextAlignment(VerticalAlignment.Center);
stamp.setHorizontalAlignment(HorizontalAlignment.Center);
stamp.setVerticalAlignment(VerticalAlignment.Center);
// add stamp to page collection
pdfDocument.getPages().get_Item(1).addStamp(stamp);
pdfDocument.save("test.pdf");
hi tilal. thank you for the code. it works
Hi Chit,