0

Im trying to do a file conversion using PDFTron

I have something that looks like this:

 try
 {
    docpdf = new pdftron.PDF.PDFDoc();
    string fullpath = ApplicationData.Current.LocalFolder.Path +"\\"+ Constants.DataDirectory + "\\" + document.GetFullPath().Replace("/", "\\");

    pdftron.PDF.Convert.ToPdf(docpdf, fullpath);
    StorageFile fileConverted = await currentFolder.CreateFileAsync(docpdf.GetDocInfo().GetTitle(), CreationCollisionOption.ReplaceExisting);
    await docpdf.SaveToNewLocationAsync(fileConverted, pdftron.SDF.SDFDocSaveOptions.e_linearized);

    MyPDFViewCtrl.SetDoc(docpdf);
    MyPDFViewCtrl.SetPageViewMode(pdftron.PDF.PDFViewCtrlPageViewMode.e_fit_width);
}
catch (Exception e)
{
   Debug.WriteLine(e.Message);
}

But i get a exception on the Convert.ToPdf line

The text associated with this error code could not be found.

Exception: Message: An error occurred while converting the file. Detailed error: ToPDF cannot convert this file format on this platform. Conditional expression: false Filename : Convert.cpp
Function : trn::PDF::Convert::ToPdf Linenumber : 1825

Is it not possible on windows 8 store apps?

croxy
  • 4,082
  • 9
  • 28
  • 46
Thought
  • 5,326
  • 7
  • 33
  • 69

2 Answers2

1

Conversion of PPT to PDF is not built-in to PDFNet SDK for Windows Store Apps. Conversion of these file types is supported on PDFNet SDK for Windows (desktop/server, the PDFNet SDK variants downloadable from https://www.pdftron.com/pdfnet/downloads.html) using Office Interop. What some of PDFNet users will do is send those documents to a server of theirs, convert them to PDF on that server, then send them back to the device.

We also just released direct DOCX to PDF conversion available on all platforms PDFNet is available on, including Windows Universal. PPTX support is coming in a few months.

Ryan
  • 2,473
  • 1
  • 11
  • 14
0

Try the following:

pdftron.PDF.Convert.OfficeToPDF(
  docExcel, 
  appdirectory + @"\" + filenameExcel, 
  new pdftron.PDF.ConversionOptions()
);
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • 2
    Hi there, and welcome to Stack Overflow. Thank you for your contribution. It may be valuable to expand on your answer with a brief explanation of why this addresses the original problem. – Jeremy Caney Feb 04 '20 at 20:23