Category Archives: Uncategorized

Exception Handling in PDFNet for Windows Store apps

Starting with PDFNet SDK 6.2.0-BETA for Windows Store apps, it is now possible to get more useful error messages when PDFNet throws exceptions.

Due to limitations of the COM API boundary, only System.Exception could be passed from the PDFNet SDK to the consuming code. This limited the errors to those that were already defined and prevented custom information to be attached.

To overcome this, PDFNet SDK for Windows Store apps has a new class; pdfnet.Common.Exception that can be created with an HResult from a System.Exception and will be able to display the information relevant to the error that caused the Exception.

The following code snippet shows an example in how to use the new PDFNetException class:

string errText = "NONE";
try
{
	pdftron.PDF.PDFDoc doc = new pdftron.PDF.PDFDoc("not_valid");
}
catch (Exception ex)
{
	pdftron.Common.PDFNetException pdfNetEx = new pdftron.Common.PDFNetException(ex.HResult);
	errText = string.Format("Exeption at line {0} in file {1}", pdfNetEx.LineNumber, pdfNetEx.FileName);
	errText += Environment.NewLine;
	errText += string.Format("Message: {0}", pdfNetEx.Message);
}
MessageDialog errorDialog = new MessageDialog(errText);
await errorDialog.ShowAsync();

Will show the following error message:
ErrorMessage

This information will be very valuable to us if PDFNet throws an unexpected Exception. If you encounter an Exception while working with the PDFNet SDK for Windows Store apps, it is a good idea to include the full error from PDFNetException.ToSTring() with the description of the problem sent to our support team.

High Quality EPUB / HTML From PDF

Want to create high quality, fixed layout EPUBs from a PDF? Or simply want to show a PDF file in the browser, taking full advantage of the power of HTML and the browser? Or maybe you just want a simple way to integrate PDF viewing into your web application, without the need for any plugins.

Our new PDF to HTML conversion in PDFNet allows for the creation of fixed layout HTML content. It is optimized to create HTML content that balances accuracy of the source material, while not overburdening the browser. Furthermore, PDFNet can also automatically generate  EPUB 3.0 files for you.

Benefits of converting PDF to fixed layout HTML

  • Viewable on any platform without any need for a plugin.
  • Built in text selection and searching.
  • Easy to integrate into existing web applications.
  • Search engine indexing.

Continue reading