How to optimize output HTML for printing

If you need to optimize HTML output for printing you should set ForPrinting option HtmlViewOptions. This option implemented for:

  • Presentation documents: PPT,PPS,PPTX,PPSX,ODP,FODP,OTP,POT,POTX,POTM,PPTM,PPSM
  • Diagram documents: VSD,VSDX,VSS,VST,VSX,VTX,VDW,VDX,VSSX,VSTX,VSDM,VSSM,VSTM
  • Meta file formats: WMF, WMZ, EMF, EMZ
 using (Viewer viewer = new Viewer("some-document.doc"))
 {
      HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources("result.html");
      //HtmlViewOptions options = HtmlViewOptions.ForExternalResources("p_{0}.html", "p_{0}_{1}", "p_{0}_{1}");
      
      options.ForPrinting = true;

      viewer.View(options);
 }

If ForPrinting option is enabled output HTML pages will be converted to vector SVG format for better quality for print and page layout.

More resources

GitHub Examples

You may easily run the code above and see the feature in action in on GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.