Ok - So using the command line - How Do you set the User Password as NULL ? (i.e. not have a user password....)
-----Original Message----- From: Paulo Soares [mailto:[EMAIL PROTECTED] Sent: 05 November 2003 10:45 To: 'Hibbard, Mark'; '[EMAIL PROTECTED]' Subject: RE: [iText-questions] Security on document It still works for me. Are you sure that you are sending me the content of encryptedbytes? Does the the program com.lowagie.tools.encrypt_pdf.java work for you? Best Regards, Paulo Soares > -----Original Message----- > From: Hibbard, Mark [SMTP:[EMAIL PROTECTED] > Sent: Tuesday, November 04, 2003 16:10 > To: 'Paulo Soares'; Hibbard, Mark; > '[EMAIL PROTECTED]' > Subject: RE: [iText-questions] Security on document > > Definately not seeing a cached version. Attached is the document produced. > > This was produced from the exact code I sent earlier. > > -----Original Message----- > From: Paulo Soares [mailto:[EMAIL PROTECTED] > Sent: 04 November 2003 16:04 > To: 'Hibbard, Mark'; '[EMAIL PROTECTED]' > Subject: RE: [iText-questions] Security on document > > > The user null means that the doc can be opened but all the security > restrictions apply. Aren't you using this with a browser and always seeing > a > cached version? You code is correct and I would like to see the pdf > resulting from it. > > Best Regards, > Paulo Soares > > > -----Original Message----- > > From: Hibbard, Mark [SMTP:[EMAIL PROTECTED] > > Sent: Tuesday, November 04, 2003 15:58 > > To: 'Paulo Soares'; Hibbard, Mark; > > '[EMAIL PROTECTED]' > > Subject: RE: [iText-questions] Security on document > > > > Ok. But even if I do use PdfEncryptor.encrypt I still don't see it > working > > correctly, i.e. it only works if i set a user password. > > > > Maybe I am doing something wrong? But then why would it work when > setting > > a > > user password? > > > > Below is my code - I basically join two pdf documents (using PdfCopy) > into > > a > > ByteArrayOutputStream, and then open a PdfReader on this OutputStream, > > creating a new ByteArrayOutputStream with the encrypted version. > > > > > > log.debug("Getting page size from PdfReader"); > > Rectangle psize = pdfReader.getPageSize(1); > > > > log.debug("Creating new document"); > > Document document = new Document(psize); > > > > log.debug("Creating pdfCopy Object"); > > > > ByteArrayOutputStream bytes = new ByteArrayOutputStream(); > > PdfCopy pdfCopy = new PdfCopy(document, bytes); > > > > // pdfCopy set Encrytion is NOT supported by iText > > // pdfCopy.setEncryption(false,null,"CSFBSecurity", > > PdfWriter.AllowPrinting); > > > > int i = 0; > > > > // Open the document for writing > > document.open(); > > > > log.debug("Creating each page"); > > while (i < numPages) { > > document.newPage(); > > i++; > > log.debug("Getting page no: " + i); > > PdfImportedPage page = pdfCopy.getImportedPage(pdfReader, i); > > log.debug("Got page"); > > pdfCopy.addPage(page); > > > > log.debug("Processed page " + i); > > } > > > > log.debug("Finished writing out doc to pdf file - now adding > > signature > > page"); > > > > PdfReader sigpdfReader = new PdfReader(buffer); > > int numSigPages = sigpdfReader.getNumberOfPages(); > > log.debug("Number of Signature Pages: " + numSigPages); > > i = 0; > > while (i < numSigPages) { > > document.newPage(); > > i++; > > PdfImportedPage page = pdfCopy.getImportedPage(sigpdfReader, i); > > pdfCopy.addPage(page); > > > > log.debug("processed signature page " + i); > > } > > > > log.debug("Concatenation complete - closing document"); > > > > document.close(); > > > > log.debug("Size of document in ByteArrayStream: " + bytes.size()); > > > > /* Add security to pdf doc */ > > log.debug("Encrypting document"); > > PdfReader finalpdfReader = new PdfReader(bytes.toByteArray()); > > ByteArrayOutputStream encryptedbytes = new > ByteArrayOutputStream(); > > > > log.debug("Reading whole document complete"); > > PdfEncryptor.encrypt(finalpdfReader, encryptedbytes,false,null, > > "CSFBSecurity", PdfWriter.AllowPrinting); > > log.debug("Encryption complete"); > > > > > ============================================================================== This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. CREDIT SUISSE GROUP and each legal entity in the CREDIT SUISSE FIRST BOSTON or CREDIT SUISSE ASSET MANAGEMENT business units of CREDIT SUISSE FIRST BOSTON reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. ============================================================================== ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
