How to add borderinfo in PHP using aspose.Pdf Interop

What would the equivalent code of the following line in PHP. I have tried various forms and I keep getting error.

cell1Row1.Border = New BorderInfo(CType(BorderSide.All, Integer), 0.5)

Thanks

Raji


This message was posted using Aspose.Live 2 Forum

Hello Raji,

Please try using the following code lines. In case it does not satisfy your requirements or you have any further query, please feel free to contact.

[PHP]

//Set default cell border using BorderInfo object

$Binfo = new COM("Aspose.Pdf.BorderInfo");
$GInfo = new COM("Aspose.Pdf.GraphInfo");
$GInfo->LineWidth = .5;

$Binfo->Left=$GInfo;
$Binfo->Right=$GInfo;
$Binfo->Bottom=$GInfo;
$Binfo->Top=$GInfo;

$tab1->DefaultCellBorder = $Binfo;
$cell1Row1->Border = $Binfo;

We apologize for your inconvenience.

Dear Nayyez,

Thank you so much. That works great. Please could you send me a sample script in PHP for creating a table with rows and cells. I am struggling to relate the .Net API syntaxes in PHP.

Thanks

Raji

Dear Nayyez,

How did you define $cell1Row1. I tried the following code but it throws the error given below

$cell1Row1 = new COM("Aspose.Pdf.Cells");
$row1->Cells = $cell1Row1;

Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `Cells': Unknown name. ' in C:\Program Files\3w\www\WhoWhatWhere\testAsposePdf.php:34 Stack trace: #0 Thaanks

Raji

Looks like there is very little support for Aspose.Pdf with PHPor Classic ASP.

Very sadd.

Raji

Hello Raji,

Sorry for replying you late.

You can use the following code line to add the cell to table row.

$cell1Row1 = new COM("Aspose.Pdf.Cells");
$row1->Cells->Add($cell1Row1);

In case you still face any issue, please share the complete code snippet so that we can test the scenario at our end.

We apologize for your inconvenience.

PS, I am not sure how you are defining the table row object.

No luck. When I use the code sample you have provided I get the following error:-

Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup `Cells': Unknown name. ' in C:\Program Files\3w\www\WhoWhatWhere\testAsposePdf.php:

I have to give a report on how aspose is working with PHP today. As of now I am quite certain it is not going to work well with PHP since I havent manage to create a single Pdf file with a simple table. Ive been working on it for a week now.

The code that I am using to create a tables and rows is given below:-

$pdf = new COM("Aspose.Pdf.Pdf");
$sec1 = new COM("Aspose.Pdf.Section");


$table1 = new COM("Aspose.Pdf.Table");
$sec1->Paragraphs->Add($table1);
$table1->ColumnWidths = "70 2cm";

$row1 = new COM("Aspose.Pdf.Rows");
$table1->Rows= $row1;


$cell1Row1 = new COM("Aspose.Pdf.Cells");
$row1->Cells->Add = $cell1Row1;

Thanks

Hello Raji,

Sorry for replying you late.

We are working over this query and will get back to you shortly. I know you have been face an inconvenience because of this, but still i would request you to be patient and spare us little more time.

We are sorry for your inconvenience.