HI everybody.
i am trying to copy a pdf file that is signed, from an PdfReader object to
this.
My problem is this:
once the file is copied , i try to open it with acrobat (all versions), and
acrobat says to me that the sign is wrong, the error is exactly:
Details: The rate of the bytes of the sign is not valid.
///************////
PdfReader reader = new PdfReader("original.pdf");
copiaPDF(reader,"copia_original.pdf");
///***.......***////
private static void copiaPDF(PdfReader reader, String nuevo){
try {
int pageOffset = 0;
ArrayList master = new ArrayList();
int f = 0;
String outFile = nuevo;
Document document = null;
PdfCopy writer = null;
// we create a reader for a certain document
reader.consolidateNamedDestinations();
// we retrieve the total number of pages
int n = reader.getNumberOfPages();
List bookmarks = SimpleBookmark.getBookmark(reader);
if (bookmarks != null) {
if (pageOffset != 0)
SimpleBookmark.shiftPageNumbers(bookmarks, pageOffset,
null);
master.addAll(bookmarks);
}
pageOffset += n;
System.out.println("There are " + n + " pages in original");
if (f == 0) {
// step 1: creation of a document-object
document = new Document(reader.getPageSizeWithRotation(1));
// step 2: we create a writer that listens to the document
writer = new PdfCopy(document, new FileOutputStream(outFile));
// step 3: we open the document
document.open();
}
// step 4: we add content
PdfImportedPage page;
for (int i = 0; i < n; ) {
++i;
page = writer.getImportedPage(reader, i);
writer.addPage(page);
System.out.println("Processed page " + i);
}
writer.freeReader(reader);
if (!master.isEmpty())
writer.setOutlines(master);
// step 5: we close the document
document.close();
}catch(Exception e) {
e.printStackTrace();
}
}
///*************////
thanks
--
View this message in context:
http://www.nabble.com/COPY-PDF-FILE-WITH-PdfReader-tp14395589p14395589.html
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/