Adding a Table to an existing PDF document

I am trying to add a PDFLightTable object to an existing PDF document. I also need to obtain the size of the table after it's drawn, so I cannot use the draw method using the Graphics object as the first argument.

The problem I have it that I need to open the existing object into a PDFLoadedDocument object. The Pages collection returns a PDFLoadedPage object, and this object cannot be passed into the table's draw method, and it cannot be converted into a PDFPage object either. I've tried passing the existing page as a PdfPageBase object, but that also fails with the error:

"Unable to cast object of type 'Syncfusion.Pdf.PdfLoadedPage' to type 'Syncfusion.Pdf.PdfPage'."

Has anyone been able to accomplish this with version 6.3.0.6?



AddingTableToPDF_74df9088.zip

3 Replies

SS Sri Subhashini M Syncfusion Team June 2, 2008 07:20 AM UTC

Hi,

Thank you for your interest in Essential PDF.

It is not possible to convert the PdfLoadedPage as PdfPage. You can draw the PdfLightTable to an existing document by convert it as a PdfDocument. We can access pdfPages from the PdfDocument.

Kindly use the below code to convert the PdfLoadedDocument to pdfDocuemnt.

' Convert PdfLoadedDocument to PdfDocument"
Dim doc As PdfDocument = New PdfDocument()
doc.ImportPageRange(pdfDoc, 0, pdfDoc.Pages.Count-1)

Please look into the sample which is available from the below specified link and let me know if this helps.

http://websamples.syncfusion.com/samples/Pdf.Windows/F74142/main.htm

Regards,
Suba




SL Scott Leclerc June 2, 2008 07:02 PM UTC

Thanks, that worked great.



SS Sri Subhashini M Syncfusion Team June 9, 2008 04:21 AM UTC

Hi,

Glad to know that it helps you.

Please let me know if you have any other queries.

Best,
Suba


Loader.
Up arrow icon