Click or drag to resize
Pdf Library for .NET
Troubleshooting
Conversion failure. Could not find 'Select.Html.dep'.

SelectPdf Html To Pdf Converter for .NET needs 2 files to work: the .NET assembly Select.Pdf.dll and one additional file (Select.Html.dep). This additional files, because it does not have a reference in the project, might not get copied to the deployment destination. To fix the problem, copy it manually. More details about this in the deployment section.

Conversion failure. Exception of type 'System.OutOfMemoryException' was thrown.

This error might occur in case of html to pdf conversion of large web pages, containing many / very large images.

Our tool initially converts the images to bitmaps and then compresses them to jpg internally. If you have several large images (with large resolutions), even if you display them in a 20x30 box in html, they are still large and when converted to bmp, they consume a lot of memory.

To work around this problem, you need to have your images optimized for the web. Alternatively, if you use an x64 system, you can use SelectPdf x64 optimized version that allows the allocation of a lot more memory than the default x86 version.

Conversion failure error 5.

The error code is this:

ERROR_ACCESS_DENIED

5 (0x5)

Access is denied.

Enable execute permissions on Select.Html.dep.

Conversion failure error 32.

The error code is this:

ERROR_SHARING_VIOLATION

32 (0x20)

The process cannot access the file because it is being used by another process.

Probably something happened during application files transfer and Select.Html.Dep remained locked. Try to reupload it.

Conversion failure error 1260.

The error code is this:

ERROR_ACCESS_DISABLED_BY_POLICY

1260 (0x4EC)

This program is blocked by group policy. For more information, contact your system administrator.

Our tool launches a new process that renders the html. The application needs enough rights to do that.

Sometimes, during html to pdf conversion, when web fonts are used, the generated PDF document contains the wrong fonts and some texts are messed up. The html to pdf converter renders Gibberish.

This problem should be fixed in v17.1 version.

Issue with web fonts on HTML to PDF conversion.

If you are using web fonts in your web pages, make sure you provide either TTF or WOFF versions for them, as these are the only 2 web font types supported by SelectPdf.

When a html string is converted to pdf, the styles are not applied and the images are missing.

When you convert a string to pdf and have references to external resources, the converter needs to know the location of the html. To do that you need to use the version of ConvertHtmlString method has also an additional parameter called baseUrl. Use that to specify the path where the file should be. Using it and the relative path to the image or css or js file from html, the converter will be able to calculate the full path to the resource file. ConvertHtmlString(String, String) contains an additional parameter: baseUrl. The baseUrl parameter allows the converter to resolve relative urls. Basically, baseUrl + relative image/css url = full absolute url.

I convert a web page to PDF and one of the images gets split between 2 pages. How do I make it stay in one page?

There are 2 solutions for this problem:

Solution 1: Set the KeepImagesTogether to True. This property instructs the converter whether to try to avoid cutting off the images between pdf pages or not. Due to the fact that images could be large and avoiding cutting them would great large gaps in the pdf pages, the default value for this property is False. Please note that using this solution will make all images from the web page to stay in the same PDF page and not get split.

Solution 2: Modify the html and set the style page-break-inside: avoid on the img tag of the image that you need to stay in one page.

The "page-break-inside" property sets whether a page break is allowed INSIDE a specified element. The element can be anything (image, table, table row, div, text, etc).

<div style="page-break-inside: avoid">
The content of this div element will not be split into several pages (if possible) because "page-break-inside" property is set to "avoid".
</div>
HTML to PDF. Conversion error: Navigation timeout.

The error message is self-explanatory and the error can be caused by multiple things:

1. The web page takes a long amount of time to load. The default amount of time that SelectPdf waits for a page is 60 seconds. If the page takes longer to load, try to increase the timeout using the property MaxPageLoadTime property of the HtmlToPdfOptions object:

// instantiate a html to pdf converter object
HtmlToPdf converter = new HtmlToPdf();

// set the page timeout (in seconds)
converter.Options.MaxPageLoadTime = 120;

2. The url of the web page being converted is not resolved on the server. We've seen cases with servers that were not able to resolve urls of the domains hosted on the same machine. Connect remotely to your server and check to see if the url is resolved.

3. You are using a proxy server to connect to the internet. SelectPdf Html to Pdf Converter supports this option and can convert web pages that can be accessed only though a proxy server. Use ProxyOptions property of the HtmlToPdfOptions object to setup your proxy.

4. You are using an Azure website. SelectPdf only works on Azure if you deploy to a Cloud Service or Virtual Machine.