How do I view/convert TXT and HTML files to Silverlight using SilverDox?

Q: Also I observe what .txt files was sent to virtual printer with
GUI appearance. How this scenario will work on case if Windows 2008 R2
Server Core installed with no GUI? How it is possible to parallelize
this process? I need to have ability to run as many converter
instances as it possible with server computational resources. With
virtual printer approach this will limit me for only one document at
time what is not acceptable for server environment with hundreds or
thousands of simultaneous clients.

Is any workarounds available to override these issues exist?

I use:
docpub64.exe PDFTron DocPub 1.2
Windows 7 x64 with SP1
MS Office 2010 x32


A: In case of HTML you can use ‘pdftron.PDF.Html2Pdf’ to convert HTML
to PDFDoc then stream (or save) the result to Silverlight Xod. For an
example please see: Html2Pdf sample:
http://www.pdftron.com/pdfnet/samplecode.html#Html2Pdf.

Regarding TXT files we are planning to added direct support for
conversion that will not depend on a printer driver.

In the meantime, you could use PDFNet SDK (http://www.pdftron.com/
pdfnet). As a starting point you may want to take a look at
SilverDoxConvert and SilverDoxStreaming samples. The equivalent of
DocPub in PDFNet is ‘pdftron.PDF.Convert.ToSilverlight()’.

In case of TXT file you can first convert it to in-memory PDFDoc (see
the discussion below) and then call
‘pdftron.PDF.Convert.ToSilverlight()’ on the resulting PDFDoc.

There are multiple ways to convert TXT to PDF using PDFNet that do not
require a virtual printer driver:

a) You can use low-level ElementBuilder and ElementWriter to place
text on a PDF page as shown in the attached document (also
http://pdfnet-sdk.googlegroups.com/web/Text2PDF.zip.doc note: you will
need to rename the file to ‘zip’).
b) If you are developing under .NET you could place the text from TXT
to a FlowDocument which you can convert to PDF and Silverlight XOD as
shown in Xaml2Pdf sample (http://www.pdftron.com/pdfnet/
samplecode.html#Xaml2Pdf)
c) Finally, you can warp the text into HTML body and convert the
resulting string to PDF / Silverlight as shown in Html2Pdf sample
http://www.pdftron.com/pdfnet/samplecode.html#Html2Pdf.