On 30/07/2012 22:50, [email protected] wrote:
> But still I face the problem even trying to use the book's solution. 
> The following code generates one internal exception on the line
> PdfImportedPage _PdfImportedPage = 
> _PdfWriter.GetImportedPage(_PdfReader, PageNumber);
>
> After this line was executed the object _PdfImportedPage contains the 
> following internal error
> "Content can not be added to a PdfImportedPage."

Let's assume you're using Pdf(Smart)Copy and that you want to add content.
Then you need to follow the instruction explained on p188-189 of the book.
These pages are in chapter 6 which is available for free.

Or suppose you're using PdfWriter.
In that case, you need to add the content to the writer, not to the page.

In any case: your question isn't clear.

As for your code:
>
> PdfPTable _PdfPTable = new PdfPTable(2);
> PdfReader _PdfReader = new PdfReader(SourcefilePath);
> PdfImportedPage _PdfImportedPage = 
> _PdfWriter.GetImportedPage(_PdfReader, PageNumber);
> _PdfPTable.AddCell(Image.GetInstance(_PdfImportedPage));
> _document.Add(_PdfPTable);

This won't add anything to the document, will it?
You're creating a table with 2 columns, but you're adding only one cell.
That means the table contains one incomplete row.
In this case, iText shouldn't add anything.

> I'm able to open with Adobe Reader the pdf file used on my test, no 
> error is shown during the process. The version of the file is 1.6

Your questions are hard to interpret for humans,
your code is hard to interpret for machines.

Again, it's unclear where you got the idea to use PdfPTable to extract 
one page.
Maybe you've taken a code sample posted to the list yesterday?
If so, you're probably using it in the wrong context.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
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

Reply via email to