I used aspose trail version Java API to add password,watermark and digital signature for word,exce and PDF documents and all worked without any issues and I am able to see the watermark and digital signature when i opened the files on laptop/desktop. But when I opened the same on iOS devices like iPhone I am unable to see the watermark and digital signature. Is this limitation in aspose API please help me in this regard.
Hi Surabhi,
- Source code to generate all three kinds of documents (Word, Excel & PDF). Preferably standalone demo applications for quick investigation.
- Input documents to your application unless documents are being created dynamically.
- Operating system details where application is running (name/version, architecture).
- JDK vendor & version.
- Are you loading the Word & Excel files in their native formats or are you converting them to PDF format first?
- What application(s) are being used to open the document files in IOS and how files are accessed?
Hi Surabhi,
com.aspose.pdf.Document pdfDocument = new
com.aspose.pdf.Document();<o:p></o:p>
pdfDocument.getPages().add();
com.aspose.pdf.TextStamp textStamp = new com.aspose.pdf.TextStamp("watermarkText");
textStamp.setWidth(500);
textStamp.setHeight(100);
textStamp.setHorizontalAlignment(com.aspose.pdf.HorizontalAlignment.Center);
textStamp.setVerticalAlignment(com.aspose.pdf.VerticalAlignment.Center);
textStamp.setRotate(-40);
new com.aspose.pdf.FontRepository();
textStamp.getTextState().setFont(com.aspose.pdf.FontRepository.findFont("Arial"));
textStamp.getTextState().setFontSize(50.0F);
textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Bold);
textStamp.getTextState().setFontStyle(com.aspose.pdf.FontStyles.Italic);
textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getDarkGray());
// iterate through all pages of PDF file
int pageSize = pdfDocument.getPages().size();
if(pageSize >= 1){
for (int page_counter = 1; page_counter <=pageSize; page_counter++)
{
//add stamp to all pages of PDF file
com.aspose.pdf.PageCollection pages = pdfDocument.getPages();
if(null != pages){
com.aspose.pdf.Page page = pages.get_Item(page_counter);
if(null != page){
page.addStamp(textStamp);
}
}
}
}
pdfDocument.processParagraphs();
pdfDocument.save("c:/pdftest/Watermark_Test.pdf");
// Create PdfFileSignature instance
com.aspose.pdf.facades.PdfFileSignature pdfSignSingle = new com.aspose.pdf.facades.PdfFileSignature();
// Bind the source PDF by reading contents of Stream
pdfSignSingle.bindPdf("c:/pdftest/Watermark_Test.pdf");//new ByteArrayInputStream(((ByteArrayOutputStream)out).toByteArray()));
// Sign the PDF file using PKCS1 object
pdfSignSingle.sign(1, true, new java.awt.Rectangle(100, 100, 150, 50), new com.aspose.pdf.PKCS1("c:/pdftest/MySPC.pfx", "test"));
// Set image for signature appearance
pdfSignSingle.setSignatureAppearance("c:/pdftest/Concatenate_Issue.PNG");
// Save final output
pdfSignSingle.save(“c:/pdftest/iOS_Vieweing_Issue.pdf”);
Hi Surabhi,
Worksheet sheet = workbook.getWorksheets().get(0);
//Add watermark
com.aspose.cells.Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1,
“CONFIDENTIAL”, “Arial Black”, 50, false, true, 18, 8, 1, 1, 130, 800);
MsoFillFormat wordArtFormat = wordart.getFillFormat();
wordArtFormat.setForeColor(Color.getRed());
wordArtFormat.setTransparency(0.9);
MsoLineFormat lineFormat = wordart.getLineFormat();
lineFormat.setVisible(false);
//Add signature line
int index = sheet.getPictures().add(0, 0, “D:/signature.jpg”);
Picture pic = sheet.getPictures().get(index);
SignatureLine s = new SignatureLine();
pic.setSignatureLine(s);
workbook.save(“D:/output.xls”);
//Save to PDF format
PdfSaveOptions options = new PdfSaveOptions();
options.setOnePagePerSheet(true);
workbook.save(“D:/output.pdf”, options);