Convert pdf to xml or .xlsx or .csv using php script with Aspose.PDF for .NET

how to convert pdf files to xml or .xlsx or .csv using php script

Hi there,


Thanks for your inquiry. We are looking into your inquiry and will update you soon.

Best Regards,

Hi,


Is there any upadate about my Inquiry.

Hi there,


Thanks for your patience. Please check following code snippet for converting PDF to Excel using PHP via COM Interop. You may use MobiXML enum value, 8, for saving PDF to XML.

Please check following documentation links for using Aspose.Pdf for .NET via COM. It is recommended to use Wrapper for working directly with Aspose.Pdf for .NET, you can create your own wrappers for your needs.



<?php

echo "

Calling Aspose.Pdf for .NET from PHP using COM Interoperatibility

";

echo "

PDF to Excel Conversion

";

//set license

$lic = new COM("Aspose.Pdf.License");

$lic->SetLicense("C:/temp/Aspose.Total.lic");

//Load Pdf Document

$input="C:/temp/HelloWorld.pdf";

$helper = new COM("Aspose.Pdf.ComHelper");

$pdf = $helper->OpenFile($input);

// Save the PDF document to desired file format by passing SaveFormat enum value for the format.

$output = "C:/temp/test_php.xls";

$pdf->Save_4($output,9);

?>


Please feel free to contact us for any any further assistance.


Best Regards,

Hi,


Thank you for your reply.I got some doubts.


i)

$lic = new COM(“Aspose.Pdf.License”);

$lic->SetLicense("C:/temp/Aspose.Total.lic");

Where can i get the files "Aspose.Total.lic" and from which file I have to create the object "Aspose.Pdf.License".

ii) $pdf->Save_4($output,9);

What is "9" in the above code.

iii) can we use this code to convert the pdf file into csv.

iv) Use Aspose.Pdf for .NET via COM Interop.

the above link is not working.

Hi there,


Thanks for your feedback. Please check documentation link to <a href="Aspose.PDF for .NET via COM Interop|Aspose.PDF for .NET>use Aspose.Pdf for .NET via COM interop. You need to use register Aspose.Pdf for .NET dll with COM interop. So Aspose.Pdf for .NET classes will be accessible in COM programming as we instantiate object of Aspose.Pdf.License file.

To remove the evaluation limitation, you need to instantiate the license object and point it to a valid license file. If you are evaluating Aspose.Pdf for .NET without any valid license then you may request a 30 days temporary license and apply it.

In Save_4() mehtod, second parameter is SaveFormat enum value. As suggested in above link , you can create a tlb file and view all classes, method, properties and enum in object browser.

I am afraid Aspose.Pdf for .NET can not convert PDF to CSV directly, you can do it with collaboration of Aspose.Pdf and Aspose.Cells. Initially convert PDF to XLS using Aspose.Pdf and later convert that XLS to CSV using Aspose.Cells.

Please feel free to contact us for any further assistance.

Best Regards,

@rameshchoudary

We would like to share with you that Aspose.PDF for .NET 20.7 now offers a feature to convert PDF to CSV directly by specifying saving format. Please consider using following code snippet:

ExcelSaveOptions options = new ExcelSaveOptions();
options.ConversionEngine = ExcelSaveOptions.ConversionEngines.NewEngine;
options.Format = ExcelSaveOptions.ExcelFormat.CSV;

Document pdfDocument = new Document("Currencies.pdf");
pdfDocument.Save("Currencies.csv", options);