|
| iTextSharp Error message |
 |
Wed, 12 Mar 2008 18:23:37 +000 |
Hi,
I am getting the following error message when I try to open a pdf document
retrieved from the database: "PdfReader not opened with owner
password." I think this might me occuring when a document has a copyright
mark on it because my code works OK when the document is not a copyrright pdf
document. What is the best way to ensure that the document is opened without
problem? Relevant portion of the code is given below. List<PdfReader>
documents=newList<PdfReader>( );
documents.Add( newPdfReader( fileContent1 ) );// fileContent1 and fileContent2
are two files retrieved from the database
documents.Add( newPdfReader( fileContent2 ) );Document doc1=newDocument(
);MemoryStream output=newMemoryStream( );
output.Position=0;PdfWriter writer=PdfWriter.GetInstance( doc1, output );
doc1.Open( );
PdfContentByte cbyte=writer.DirectContent;foreach ( PdfReader pdfReader in
documents )
{
// open the file to be appendedPdfReader reader=newPdfReader( pdfReader );
// load each page into the merged documentfor ( int page=1;
page<=reader.NumberOfPages; page++ )
{
doc1.NewPage( );PdfImportedPage importedPage=writer.GetImportedPage( reader,
page );
cbyte.AddTemplate( importedPage, 0, 0 );
}
}
// MERGE CODE END
doc1.Close( );
|
| Post Reply
|
| Re: iTextSharp Error message |
 |
Wed, 12 Mar 2008 23:23:12 +000 |
An odd thought that came to me while we were addressing the other thread -
Is there a need to save the PDF in the database? What about saving it on the
server instead and saving the path in the DB?
|
| Post Reply
|
|
|
|
|
|
|
|
|
|