Documents.zip (87.5 KB)
I am using Aspose.words (licencenced version) for pdf to pcl conversion in C#. I have written the below code for the conversion
private void CreatePclFromPdf(string[] pdfFilePaths, string blNo, string outputDirectory, ReportGenerationContext context)
{
foreach (string pdfFilePath in pdfFilePaths)
{
string filename = Path.GetFileNameWithoutExtension(pdfFilePath);
string pclFilePath = Path.Combine(outputDirectory, blNo+ "_" +filename + ".pcl");
string docFilePath= Path.Combine(outputDirectory, filename + ".doc");
Aspose.Words.Document document = new Aspose.Words.Document(pdfFilePath);
// save PDF as a DOC
document.Save(docFilePath, Aspose.Words.SaveFormat.Doc);
// load Doc with an instance of Document
string docfilename = Path.GetFileNameWithoutExtension(docFilePath);
var outputDocument = new Aspose.Words.Document(docFilePath);
// call save method while passing SaveFormat.Pcl
outputDocument.Save(pclFilePath, Aspose.Words.SaveFormat.Pcl);
}
}
Please note that original pdf file and the generated doc file is perfect but the final pcl file is not correct since it adds one more page with some text in different language which is not present anywhere in the original document.
The original pdf file ,generated doc and pcl files are given as attachment.Please find the attachment.
Attachsheet1.pdf (89.8 KB)
@amitabha83 In your code the PDF document is read into Aspose.Words model. You should note, Aspose.Words is designed to work with MS Word documents. MS Word documents are flow documents and they have structure very similar to Aspose.Words Document Object Model. On the other hand PDF documents are fixed page format documents . While converting PDF document Fixed Page Document structure is converted into the Flow Document Object Model. Unfortunately, such conversion does not guaranty 100% fidelity. We recently implemented a direct way to convert PDF documents to fixed page formats (without loading PDF document to Aspose.Words DOM):
Aspose.Words.LowCode.Converter.Convert(@"C:\Temp\in.pdf", @"C:\Temp\out.xps");
Unfortunately, currently there is no direct conversion to PCL. I have created a feature request WORDSNET-27195 for this.
@alexey.noskov Thanks for your support.But my requirement is to convert pdf to pcl.So I need to convert the xps to pcl.Please provide a sample code.
@amitabha83 Yes, I understand your requirements. So I have created WORDSNET-27195 to add direct conversion from PDF to PCL without loading PDF document to Aspose.Words DOM. We will let you know once it is implemented.
I also need to convert from xlsx to pcl.Is the same problem exits?
@amitabha83 Aspose.Words does not support loading xlsx format. You should use Aspose.Cells to work with Excel documents.
where can i find the demo code for excel to pcl conversion ? Please help
@amitabha83 Please see Aspose.Cells documentation to learn what formats are supported:
https://docs.aspose.com/cells/net/supported-file-formats/
You can contact Aspose.Cells support in the appropriate forum to get more information about Aspose.Cells features.
can you provide some code for xlsx to pcl conversion in C#
@amitabha83 Please contact Aspose.Cells support. My colleagues from Aspose.Cells team will help you shortly.
The issues you have found earlier (filed as WORDSNET-27195) have been fixed in this Aspose.Words for .NET 24.9 update also available on NuGet.