PeachPDF

PeachPDF.Network

FileUriNetworkLoader Class

An RNetworkLoader that serves the root HTML document and every resource it references (stylesheets, images, fonts) from the local file system via file: URIs. Its BaseUri is set the way a browser sets a local document’s base URL: to the loaded file’s own file: URI (so relative references resolve against its directory), or — when no primary file is given — to the current working directory. file: resources resolve through this loader automatically regardless of which loader is configured (mirroring how data: URIs are always handled internally), so relative references in an in-memory HTML string load from disk by default. Setting AllowLocalFileAccess to false turns that off: file: resource requests are then refused even for a document rendered through this loader, though the root document it was constructed with is still read.

public class FileUriNetworkLoader : PeachPDF.Network.RNetworkLoader

Inheritance System.ObjectRNetworkLoader → FileUriNetworkLoader

Constructors  
FileUriNetworkLoader() Creates a loader whose base URI is the current working directory, for rendering an in-memory HTML string whose relative references should resolve against the process’s working directory. GetPrimaryContents() is not supported on an instance created this way — pass the HTML directly to PdfGenerator.GeneratePdf/AddPdfPages instead.
FileUriNetworkLoader(string) Creates a loader whose root document is the file at primaryFilePath and whose base URI is that file’s own file: URI, so relative references resolve against the file’s directory — exactly like opening a local .html file in a browser. Pass null as the HTML argument to PdfGenerator.GeneratePdf/AddPdfPages to render this file.
Properties  
BaseUri The document’s base URL, used to resolve relative href, src, and CSS url() references. If null, relative references are resolved against the local file system.
Methods  
GetPrimaryContents() Returns the root HTML document as a string. Called once at the start of rendering when null is passed as the HTML argument to a PdfGenerator.GeneratePdf/AddPdfPages overload.
GetResourceStream(RUri) Returns the content of an external resource (a stylesheet or image) referenced by the document, or null if the resource cannot be resolved.