I am using iText to modify a PDF to remove Extended Features using the process
described on page 278 of the book. It appears to produce the expected result.
However, I then open the PDF in Acrobat and add password encryption. When I do
this and attempt to save the PDF, I get an error "The document could not be
saved. Bad parameter."
Test case code is below. I can provide the input PDF "text-ext.pdf" via email
upon request.
Any help you can provide would be appreciated.
------------------- cut here --------------
package test;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class TestIText
{
public static void main(String[] args)
{
try
{
FileInputStream pdfInputStream = new FileInputStream("test-ext.pdf");
PdfReader reader = new PdfReader(pdfInputStream);
reader.removeUsageRights();
// open PDF stamper on output PDF
FileOutputStream destStream = new FileOutputStream("test-noext.pdf");
PdfStamper stamper;
stamper = new PdfStamper(reader, destStream);
stamper.close();
destStream.close();
pdfInputStream.close();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
____________________________________________________________________________________
Kevin Klein | Director of Technology | Celera Systems LLC |
kkl...@celerasystems.com<mailto:kkl...@celerasystems.com>
Bus 262.834.0080 x203 | Fax 262.834.0079 |
www.celerasystems.com<http://www.celerasystems.com>
10325 North Port Washington Rd, Suite 100 Mequon, WI 53092
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php