Skip to footer content
USING IRONPDF

Generating Complete, Branded PDFs from Apps Behind a Corporate Proxy

Enterprise applications that generate PDFs from HTML often run inside locked-down networks with no direct route to the internet. The problem surfaces at render time: an invoice or report template references a logo, web font, or stylesheet hosted on an external CDN, and inside the corporate network those requests fail silently. The document comes out unstyled, with broken images and missing fonts. Routing the rendering engine through the company proxy fixes this, and IronPDF accepts a proxy directly on its render call.

The Business Problem

A finance, healthcare, or insurance app produces client documents from web templates. Those templates pull external assets, but the server sits behind a firewall and proxy. Without proxy configuration, the engine cannot reach the assets, so the output looks broken. Many of these environments also run authenticated proxies, which adds credentials to the requirement.

The Solution

The proxy is a parameter on the RenderHtmlAsPdf method, not a property on the render options. Passing a proxy string routes all asset requests from the engine through that proxy.

using IronPdf;

var renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf(
    htmlContent,
    baseUrlOrPath: @"C:\templates\assets\",
    proxy: "http://proxy.corp.local:8080"
);
pdf.SaveAs("report.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf(
    htmlContent,
    baseUrlOrPath: @"C:\templates\assets\",
    proxy: "http://proxy.corp.local:8080"
);
pdf.SaveAs("report.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(
    htmlContent,
    baseUrlOrPath: "C:\templates\assets\",
    proxy: "http://proxy.corp.local:8080"
)
pdf.SaveAs("report.pdf")
$vbLabelText   $csharpLabel

For an authenticated proxy, credentials go in the proxy URL. Special characters in the password must be percent-encoded.

string encoded = Uri.EscapeDataString("P@ssw0rd!");
string proxy = $"http://svc-account:{encoded}@proxy.corp.local:8080";

PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlContent, baseUrlOrPath: null, proxy: proxy);
string encoded = Uri.EscapeDataString("P@ssw0rd!");
string proxy = $"http://svc-account:{encoded}@proxy.corp.local:8080";

PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlContent, baseUrlOrPath: null, proxy: proxy);
Imports System

Dim encoded As String = Uri.EscapeDataString("P@ssw0rd!")
Dim proxy As String = $"http://svc-account:{encoded}@proxy.corp.local:8080"

Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(htmlContent, baseUrlOrPath:=Nothing, proxy:=proxy)
$vbLabelText   $csharpLabel

Rendering Internal URLs Behind a Proxy

The URL render method does not accept a proxy parameter. The practical pattern is to fetch the HTML with an HttpClient configured for the proxy, then render that HTML so the referenced assets route through the proxy too.

using System.Net;
using System.Net.Http;

var webProxy = new WebProxy("http://proxy.corp.local:8080")
{
    Credentials = new NetworkCredential("svc-account", "P@ssw0rd!")
};
var handler = new HttpClientHandler { Proxy = webProxy, UseProxy = true };
using var httpClient = new HttpClient(handler);

string html = await httpClient.GetStringAsync("https://dashboard.internal.corp/report");
PdfDocument pdf = renderer.RenderHtmlAsPdf(html, baseUrlOrPath: null, proxy: "http://proxy.corp.local:8080");
using System.Net;
using System.Net.Http;

var webProxy = new WebProxy("http://proxy.corp.local:8080")
{
    Credentials = new NetworkCredential("svc-account", "P@ssw0rd!")
};
var handler = new HttpClientHandler { Proxy = webProxy, UseProxy = true };
using var httpClient = new HttpClient(handler);

string html = await httpClient.GetStringAsync("https://dashboard.internal.corp/report");
PdfDocument pdf = renderer.RenderHtmlAsPdf(html, baseUrlOrPath: null, proxy: "http://proxy.corp.local:8080");
Imports System.Net
Imports System.Net.Http

Dim webProxy As New WebProxy("http://proxy.corp.local:8080") With {
    .Credentials = New NetworkCredential("svc-account", "P@ssw0rd!")
}
Dim handler As New HttpClientHandler With {
    .Proxy = webProxy,
    .UseProxy = True
}
Using httpClient As New HttpClient(handler)
    Dim html As String = Await httpClient.GetStringAsync("https://dashboard.internal.corp/report")
    Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(html, baseUrlOrPath:=Nothing, proxy:="http://proxy.corp.local:8080")
End Using
$vbLabelText   $csharpLabel

Points to Plan For

  • Proxy auth is not page auth: Credentials in the proxy URL authenticate against the proxy, which differs from website login credentials.
  • Scheme refers to the proxy hop: An http:// proxy can still fetch https:// resources, so the scheme choice is about whether the app-to-proxy connection needs TLS.
  • Containers and pipelines: Docker deployments and CI build agents usually have no egress, so the same proxy configuration applies there.

Result

With one parameter, teams get fully styled, branded PDFs out of applications running behind a corporate proxy, including authenticated environments and containers. Full configuration details are in the proxy guide.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me