PdfSaveOptions.OpenHyperlinksInNewWindow

PdfSaveOptions OpenHyperlinksInNewWindow property. Gets or sets a value determining whether hyperlinks in the output Pdf document are forced to be opened in a new window or tab of a browser.

PdfSaveOptions.OpenHyperlinksInNewWindow property

Gets or sets a value determining whether hyperlinks in the output Pdf document are forced to be opened in a new window (or tab) of a browser.

public bool OpenHyperlinksInNewWindow { get; set; }

Remarks

The default value is false. When this value is set to true hyperlinks are saved using JavaScript code. JavaScript code is app.launchURL("URL", true);, where URL is a hyperlink.

Note that if this option is set to true hyperlinks can’t work in some PDF readers e.g. Chrome, Firefox.

JavaScript actions are prohibited by PDF/A-1 and PDF/A-2 compliance. false will be used automatically when saving to PDF/A-1 and PDF/A-2.

Examples

Shows how to configure hyperlinks to open in pages when clicked in PDF.

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.OpenHyperlinksInNewWindow = true;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "PdfSaveOptions.OpenHyperlinksInNewWindow.pdf", pdfSaveOptions)
    .Execute();

See Also