How to eliminate blue text and hyperlink from documents?

Discussions related to Crystal Reports development.

Moderator: Lisa Ennis

Post Reply
Prakasha NB
Posts: 4
Joined: Thu Mar 09, 2017 3:09 am

How to eliminate blue text and hyperlink from documents?

Post by Prakasha NB »

We are rendering some of the documents like Closing Statement,Disclosure Form,CDF and Master Statement by following lines of code(For Reference). Documents are getting generating fine but we are getting blue text and hyperlink in the documents.

How can we eliminate blue text and hyperlink from rendered documents?. I have attached the sample document generated from this.

IDocumentInfo docInfo = docMgr.Documents.Where(t => t.Title == docName && t.Identifier.Name.Contains("DOC")).First();
RenderPrompts prompts = new RenderPrompts();
context = GetContext(identifier, Order);
IRendering rendering = renderer.Render(docInfo, context, prompts);
string FileName = string.Format("{0}_{1}", OrderNumber, docInfo.Title);
string FilePath = Convert.ToString(ConfigurationManager.AppSettings["SoftProDocPath"]);
string GeneratedFile = string.Format("{0}\\{1}.pdf", FilePath, FileName);
using (Stream file = File.Create(GeneratedFile))
{
ExportSettings Settings = new ExportSettings() { Format = DocumentFormat.PortableDocumentFormat, Redacted = true };
Stream docStream = rendering.Export(Settings);
docStream.Seek(0, SeekOrigin.Begin);
docStream.CopyTo(file);
}
docDict.Add(string.Format("{0}.pdf", FileName), new MemoryStream(File.ReadAllBytes(GeneratedFile)));
File.Delete(GeneratedFile);

Thanks in Advance.
Attachments
CH5612-1800046_Master Statement Letter (CDF).pdf
Sample file generated from our code
(76.66 KiB) Downloaded 88 times
Lisa Ennis
Posts: 84
Joined: Thu Sep 11, 2008 1:57 pm

Re: How to eliminate blue text and hyperlink from documents?

Post by Lisa Ennis »

There is a Boolean property you need to set called RemoveHotspots in the ExportSettings class. This needs to be set to True.

If you are on an older version of Select, and the RemoveHotspots property is not on the ExportSettings class, the IRenderer interface has a DisableHotspots Boolean property that, if set to true, would do the same thing.

Hope this helps.
Lisa Ennis
Senior Report Developer
SoftPro
Prakasha NB
Posts: 4
Joined: Thu Mar 09, 2017 3:09 am

Re: How to eliminate blue text and hyperlink from documents?

Post by Prakasha NB »

I could not find both RemoveHotspots property on the ExportSettings class and DisableHotspots Boolean property on the IRenderer interface :( .

See below ExportSettings and IRenderer metadata. Our Select version is 4.3.60210.48, Are those properties private? :roll:

public sealed class ExportSettings
{
public static readonly ExportSettings Default;

public ExportSettings();

public DocumentFormat Format { get; set; }
public bool Redacted { get; set; }
}

public interface IRenderer : IDisposable
{
void RegisterService(Type serviceType, object serviceInstance);
IRendering Render(IDocumentInfo document, object context, IPrompt<PromptEventArgs> prompt);
IRendering Render(IRenderable renderable, object context, IPrompt<PromptEventArgs> prompt);
IRendering Render(IRenderingSnapshot snapshot, object context, IPrompt<PromptEventArgs> prompt);
Task<IRendering> RenderAsync(IDocumentInfo document, object context, IPrompt<PromptEventArgs> prompt, IProgress<ProgressEventArgs> progress, CancellationToken cancellationToken);
Task<IRendering> RenderAsync(IRenderable renderable, object context, IPrompt<PromptEventArgs> prompt, IProgress<ProgressEventArgs> progress, CancellationToken cancellationToken);
Task<IRendering> RenderAsync(IRenderingSnapshot snapshot, object context, IPrompt<PromptEventArgs> prompt, IProgress<ProgressEventArgs> progress, CancellationToken cancellationToken);
}
Lisa Ennis
Posts: 84
Joined: Thu Sep 11, 2008 1:57 pm

Re: How to eliminate blue text and hyperlink from documents?

Post by Lisa Ennis »

This is available as a public option in version 4.4.0 and above. This was not a public option in earlier versions.
Lisa Ennis
Senior Report Developer
SoftPro
Post Reply