HTML to PDF Conversion - Technical Articles
HTML to PDF Conversion - Questions and Answers
Q: When I convert an URL to PDF I get the "URL is not accessible" exception.
A: "The URL is not accessible" message is normally followed by a more detailed message
which should clearly indicate the root of the problem. Below is a general description
of the possible reasons of this error.
If the application works correctly on your development machine but it's not working
on the server then it's very likely to be an issue related to security, permissions
or authentication on the server.
First make sure the web page you are converting is accessible for converter. If
the page requires server authentication (like IIS authentication - Integrated Windows
Authentication) you can provide the correct Username and Password using the AuthenticationOptions
property of the PdfConverter.
If your application is using ASP.NET level authentication like Forms Authentication
the converter will not be able to automatically authenticate because it doesn't
send back to the web server the authentication cookie created during the authentication
process between the browser and IIS. In this case you have manually send the authentication
cookie using the custom HTTP headers:
if (Context.Request.Cookies[FormsAuthentication.FormsCookieName] != null)
pdfConverter.HttpRequestHeaders = String.Format("Cookie : {0}={1}",
FormsAuthentication.FormsCookieName, Request.Cookies[FormsAuthentication.FormsCookieName].Value);
Other access restrictions can be introduced by proxy servers or firewalls. When
you access the web page from Internet Explorer for example it works because the
proxy server settings are set in the Internet Options of the currently logged user
and browser will use those settings to authenticate to the proxy. It should also
work to convert that web page from a Windows Forms application because the Windows
Forms application runs under the same user as the Internet Explorer browser and
uses the same proxy settings from the Internet Options in Windows Registry. When
you try to convert the same page from an ASP.NET application, the converter, which
runs under the ASP.NET user account, is not using the Internet Settings for the
currently logged in user and therefore it won't be able to authenticate to the proxy.
Firewall servers can be a similar source of access restrictions that you'll have
to check.
To make the ASP.NET user pass through the proxy you have to set the proxy for the
ASP.NET user directly into Internet Options in Windows Registry. The following article
from Microsoft explains how to set the proxy for the currently logged in user: How to configure client
proxy server settings by using a registry file. You have to do a similar
thing for the ASP.NET user. First you have to identify the entry in the HKEY_USERS
allocated to the ASP.NET user based on its SID. You can find the SID for an user
from the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
registry entry (more details in this article ). Then you can set the proxy options in HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Internet
Settings. For example, if the NetworkService account SID is S-1-5-20 (the NetworkService
account is usually used by default as identity for the IIS pool of a website), then
you can set the proxy options and under HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Internet
Settings. After you have changed the Windows Registry it is recommended to reboot
the computer.
If you are converting a https URL from your network you can try the same URL with
http:// instead of https://. Running secured web pages requires a valid (not a self
signed) SSL certificate for the web page. If it works with http and you have a valid
SSL certificate than the error is most probably caused by an authentication problem
in your network architecture resolving the https requests from Internet because
the network credentials transmitted for the ASP.NET user are not sufficient to resolve
the https requests. To debug this you can try to use the HttpWebRequest class from
.NET framework to access the same URL under the same ASP.NET user. In general, making
the secured web page accessible from Internet should resolve the problem.
It is also possible, when converting a web page hosted on the server where you are
performing the conversion, that the server cannot resolve the site name to an IP
address. To eliminate this possibility try to use an IP address instead of a domain
name.
The development servers have a more relaxed internet security configuration then
the production servers. For example the Windows 2003 Server defaults to an internet
security configuration which may not allow you to access the URL. You may have to
relax or disable the enhanced security configuration to allow access to the pages
you want to render. If removing the internet enhanced security configuration component
is an option, you can do so from the "Add/Remove Windows Components" section of
the "Add or Remove Programs" control panel. The internet enhanced security configuration
component should be listed as "Internet Explorer Enhanced Security Configuration".
If you don't see any obvious reason for the web page to be inaccessible for the
converter try to convert a HTML file from the server disk instead of an URL. You
can simply pass to the converter the full path of the HTML file instead of the URL.
If it works with a local HTML file then you can further try with an url like http://www.google.com
which is likely to be available and accessible from your server. If this URL works
then the URL you are trying to convert might not be accessible indeed for the converter
and you should keep searching for the possible reasons. If it's not working it means
the converter is not allowed to access Internet under the ASP.NET user account and
you should further check proxy servers, firewalls, etc.
In general, because we don't know the exact network configuration of your server
or of your intranet, we cannot tell exactly which of the possible access problems
described above applies to your situation. You should carefully check the possible
situations described above and also check with your network administrator about
other possible access restrictions before going further.
If your are pretty sure there should be no access problem then make sure the web
page you are trying to convert can be correctly loaded in the Internet Explorer
browser running on your server while you are logged in as Administrator.
Make sure IE does not block the URL or throws any warnings when loading that
page. and you'll have to find the reason with your server administrator.
If none of the recommendations above helped then try to find a permissions issue.
The converter runs with the permissions granted to the ASP.NET user which are normally
much lower than the permissions under which the IE web browser application runs.
You can find out the ASP.NET user under which the converter is running by adding
the <%= Environment.UserName %> line in the .ASPX from where the converter
is called. The user name should be displayed when the .ASPX page is loaded in browser.
To make sure it's a permissions issue try to convert the same HTML page using the
Free HTML to PDF Converter Windows Forms Application that we provide as a separate
download or the one that you have built from the samples folder. This Windows Forms
application will run as the currently logged in user, preferable an Administrator.
If this application works then it might be a permissions issue. You can temporary
add the ASP.NET user (determined as above) to Administrators group on the server
or you can use ASP.NET impersonation by adding the following line in the web.config
of your application under the <system.web> section : <identity impersonate="true"
userName="WindowsDomain\YourUserName" password="YourPassword"/>.
If the conversion works you can start looking into what exactly permissions the
converter needs from your server and grant those permissions to the ASP.NET user.
A useful tool for finding permissions issues is the Process Monitor. You can
download this tool from Microsoft web site. The ProcessMonitor will monitor
every file and registry access on your machine in real time. You have to start the
tool and then make the issue to occur. You should look for suspicious FAILURE and
ACCESS DENIED messages. You can try to filter the messages by ASP.NET worker process
ID to substantially reduce the number of displayed messages. You might find for
example that the ASP.NET user cannot create files into the Internet Temporary Folder
where the images and CSS files are temporary downloaded or the ASP.NET user has
not enough rights to read the Internet Settings from Windows Registry.
If you have followed all the steps above and you could not find the reason of the
problem please contact us with the result of all these steps. We'll try to work
with you to localize the problem.
Q: When I convert a web page I get the "Navigation timeout" exception.
A: The "Navigation timeout" exception normally occurs when converting very large
or slowly accessible web pages and when loading of the web page to convert takes
more than 60 seconds. In this case you can simply set a bigger value for the PdfConverter.NavigationTimeout
property.
When you load the web page to convert in the IE web browser on the server it might
appear that the page is loaded properly but it can happen that an external resource
like an image or a CSS file referenced by the web page is not accessible. In this
case the IE web browser displays a "Waiting for..." message in the bottom
status bar. The web browser can start rendering of the web page before all the resources
are available but the converter will wait until all the resources are available
before starting conversion. Therefore you first have to make sure that the IE web
browser on the server displays a "Done" message in the bottom status bar
when you load the web page to convert.
If the web page can be completely loaded in a web browser on the server then try
to convert that web page from the Windows Forms sample that we provide in the Bin
folder of the installation directory. The web browser and the Windows Forms application
run under the same Windows account on the server and similar credentials are used
when accessing the web page. If it works from the Windows Forms application but
it's still not working from an ASP.NET application that means an external resource
is accessible under the currently logged in user but not under the ASP.NET user.
You have to identify that resource and then troubleshoot the problem using the indications
above for "URL is not accessible" exception.
If you are sure that is not a problem with loading the web page on the server then
there are a few special situation that we have identified when this error might
occur. If the web page you convert requires JavaScript to render the content then
try to enable the JavaScript execution during conversion by setting PdfConvert.ScriptEnabled
on true. Also there were situation when after an automatic Windows Update the server
was left in an unstable state. In this case a server reboot should solve the problem.
Another situation is when loading the web page requires the user confirmation before
loading the web page. In this case you have to make sure that the web page can be
loaded directly without any popups or alerts requiring user intervention.
Q: When I convert a HTML string to PDF, the external CSS files and images are not
applied in the rendered PDF document.
A: When you convert a HTML string referencing external CSS files and images by relative
URLs, the converter cannot determine the full URLs just looking at the string.
In order to solve this you have to set the baseURL parameter of
the HTML string convert function with the full URL of the page from where you have
retrieved the HTML string. This requires from the HTML string to have a valid HEAD
tag. When the relative paths of your images are textually prefixed with the baseURL
parameter the full URL of the images should be produce in order to start getting
images in PDF.
As an alternative you can manually insert a BASE tag in the HEAD tag of the HTML
page as in the example below or use full URLs in the HTML string:
<HEAD> <BASE
HREF="SiteURL"> </HEAD>
Note: This issue might also indicate an authentication or permissions
problem on the server when accessing the external resources like images and CSS
files. The HTML string is loaded into converter and the text is converted to PDF
but the images and CSS files are still accessed from an URL and they might not be
accessible.
If you are sure that the URL base you have set is correct but the images still don't
appear in PDF you can try to prefix a relative image URL from the HTML string with
the the base url to construct a full image URL. Then you can put this url in the
IE web browser on the server where you perform the conversion and check that the
image is correctly displayed in the browser. After that you can try to convert the
image URL to PDF using the GetPdfBytesFromUrl() method. If the image is not accessible
you should get a "The URL is not accessible." error. See the question above regarding
the 'URL is not accessible' exception to find out more details about how to localize
and troubleshoot this problem.
Another special situation where this problem might occur is for ASP.NET applications
using forms authentication. The ASP.NET forms authentication implementation usually
stores the forms authentication ticket in a cookie which should be sent back to
server each time a resource is requested but the converter does not have the ability
to automatically send this kind of cookie back to the server and therefore the authentication
of the requests of external resources like images and CSS files can fail. A possible
workaround for this problem is to store the images and CSS files referenced by the
web page to be converted in a location which doesn't require authentication (you
can configure this in the web.config of your application). If this is not an acceptable
solution then you can try to set the forms authentication to the cookieless mode.
In this mode the encrypted authentication ticket is set in the URL query string
and not in a cookie and the base URL parameter of the HTML string convert function
should be set accordingly to the URL containing the authentication ticket. You can
read more about forms authentication at the following address: Forms Authentication Explained .
Q:
The images and texts appear to be smaller than they are in the HTML document and
for other HTML documents the content is rendered in the left side of the document
and is not centered.
A: The Winnovative HTML to PDF converter allows a very fine control of the PDF rendering
process. The default settings of the converter should be acceptable for majority
of the situations but sometimes more control and customizations are necessary. If
want to learn more about the HTML to PDF rendering please check
this article
The converter internally uses a virtual display where to render the HTML page very
similar to what the web browser does on the screen. The virtual display resolution
is given by the Windows DPI currently set in the display properties in Windows Control
Panel. The default Windows DPI is 96 dpi (dots per inch). The web page elements
dimensions are usually measured in pixels and this is the reason why the virtual
display of the converter is also specified in pixels. These are the only dimensions
used by the converter which are expressed in pixels. All the other dimensions are
specified in points (1 point is 1/72 inches). The UnitsConverter class can
be used to convert dimensions from pixels to points and from points to pixels.
You can specify the virtual display width and height in pixels using the PdfConverter.PageWidth
and PdfConverter.PageHeight properties or you can specify the same values as parameters
when you construct the PdfConverter object.
By default the PageWidth is set to 1024 pixels which should be sufficient to display
the majority of the web pages. If the web page you are converting cannot be completely
displayed in this width then you can increase this value or you can set the PageWidth
to 0 to allow the converter to automatically determine your web page width from
the HTML elements width. The PageHeight property is 0 by default which means the
virtual display height will be automatically set to display the whole HTML page
height. In general the PageHeight property should not be set in your code. However,
there are situations when the converter cannot automatically determine the web page
height for example when the web page contains a frame set because in this case the
web page can be displayed in any height. In such a situation you can manually set
the PageHeight to the desired value in pixels.
After the HTML content is displayed in the virtual display the virtual display content
will be transferred into PDF as you would take a picture of the virtual display
and put that picture into a PDF document. The PDF documents pages have a fixed size
in points. For example, the A4 portrait page is 595 points in width and 842 points
in height. If the virtual display width is more than 595 points then the rendered
HTML content would be shrunk to fit the PDF page width and display the whole HTML
content in the PDF document. If the virtual display width is less than 595 points
then the rendered HTML content will not be resized and will be rendered in the top
left corner of the PDF page at real size.
The dimension of the A4 portrait page in virtual device pixels is 793x1122 pixels.
This means that at a default virtual display width of 1024 pixels the HTML content
will be scaled to fit the PDF page. This is the reason why you see smaller fonts
and images in PDF.
The calculation above does not take into account the possible margins set for the
PDF page and it is done at the default resolution of 96 DPI. If you have set the
PDF page margins or if you are using a custom Windows DPI then the exact calculation
of the available width in PDF page can be made using UnitsConverter API.
The FitWidth property was added to the PdfConverter.PdfDocumentOptions to control
if the rendered HTML content can be scaled to fit the PDF page width. The default
value is true which makes the HTML content to be resized if necessary to fit the
PDF page width. When false, the HTML content will not be resized and it will be
rendered at the real size in PDF.
When the FitWidth property is false the HTML content could be wider than the PDF
page width and the therefore the HTML content will be cut off to the right in PDF.
In this case, in order to get the whole content in PDF you have to set a wider page
for the PDF document. You can first try to set landscape orientation for the PDF
page by setting PdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape.
If this not enough you can choose a wider standard page like A3 or A2. It is also
possible to set a custom size for the PDF page when the PdfConvert.PdfDocumentOptions.PdfPageSize=PdfPageSize.Custom
In this case the custom size of the PDF page will be taken from PdfConverter.PdfDocumentOptions.CustomPdfPageSize
property. The PdfConverter.PdfDocumentOptions.AutoSizePdfPage was added to automatically
determine a custom PDF page width when the FitWidth property is false. The AutoSizePdfPage
can create PDF documents with non-standard PDF page size.
If you don't want to resize the PDF page but you want to keep it A4 portrait for
example, then you have to decrease the virtual display width. If your page can be
correctly and entirely displayed in 793 pixels (which is the width of the A4 portrait
page in pixels without margins at default 96 dpi resolution) you can set this value
for PdfConverter.PageWidth property and you should get the whole HTML rendered at
real size in PDF.
The HTML content centering in PDF problem can be observed when the HTML content
size is fixed and it is less than 1024 pixels in width. In this case there will
normally be an empty space in the right side of the web page displayed at 1024 pixels.
When the virtual display content is transfered to PDF the content will appear as
not centered in PDF. You can also solve this if you set the PdfConverter.PageWidth
to a value of 793 pixels or less.
Q: For some HTML documents, the HTML content appears as truncated at the right side
of the PDF page. How can I make the whole HTML content to fit the PDF page width?
A: If the PdfConverter.FitWidth property value is true as it is by default (or the
HtmlToPdfElement.FitWidth property is true in the case of the PDF Creator), then
it means that the HTML document cannot be completely displayed in 1024 pixels which
is the default value for the width of the internal browser display. To solve this
issue you have to increase the PdfConverter.PageWidth property (or HtmlToPdfElement.HtmlViewerWidth
for PDF Creator) to a value in pixels enough to allow the full display of the HTML
document.
If you don't know the optimal width of the browser for displaying the whole content
then you can try to set PdfConverter.PageWidth=0 and allow the converter to automatically
determine the width of the web page based on the size of the HTML elements inside
the HTML document.
If you set the PdfConverter.FitWidth property on false in your code (or HtmlToPdfElement.FitWidth
property for PDF Creator) then most probably the rendered HTML content width is
larger than PDF page width and since the converter was not set to fit the width
of the PDF page the content will be truncated at the right side.
There are at least two possibilities to solve this problem function of if you want
to use only standard PDF page sizes (like A4, A3, etc) or you can use custom PDF
page sizes as well.
1. If want to use only standard PDF page sizes you can try first to set a landscape
orientation for the PDF pages. You can do this by setting the PdfConverter.PdfDocumentOptions.PdfPageOrientation
= PDFPageOrientation.Landscape (or in the case of the PDF Creator product specify
a landscape orientation when you add the page that will hold the HtmlToPdfElement
to the document). You can also choose a wider standard page like A3 instead of A4
and keep the portrait orientation.
2. If you can work with custom sized PDF pages than you can simply set the PdfConverter.PdfDocumentOptions.AutoSizePdfPage=true
and the converter will automatically select a custom PDF page width such that all
the HTML document can be displayed or you can set PdfConverter.PdfDocumentOptions.SinglePage
= true to automatically determine both the width and height of the PDF page and
produce a single PDF page containing all the rendered HTML document.
Please note that the AutoSizePdfPage and SinglePage properties are available only
in the HTML to PDF Converter product.
Another possibility, which works both for the HTML to PDF Converter and for the
PDF Creator, is to specify a custom PDF page size wide enough to display the whole
HTML content.
For the HTML to PDF Converter you have to set the PdfConvert.PdfDocumentOptions.PdfPageSize=PdfPageSize.Custom
and the PdfConvert.PdfDocumentOptions.CustomPdfPageSize to the desired size in points
of the PDF page.
For the PDF Creator you can specify the size of the PDF page when you add the page
holding the HtmlToPdfElement to the PDF document.
In general, when creating PDF pages with custom size, you have to correlate the
PDF page size with the internal browser display size (which is 1024 pixels by default).
For example, if you want to render the HTML document in 1200 pixels when the FitWidth
is false, then the custom PDF page width in points can be determined using a call
to UnitsConverter.PixelsToPoints(1200).
If want to learn more about the HTML to PDF rendering please check
this article
Q: For some HTML documents there is an additional margin at the top and left sides
of the HTML document. How can I remove those additional margins?
A: The margins come from the HTML document. To remove those margins, in the HTML
document you convert set the BODY element margins to 0 pixels like in the example
below:
<body style="margin: 0px">
Q: After
I have installed IE9 on the computer where the converter runs the generated PDF
does not contain anymore searchable text.
A: First check that you didn't set by mistake PdfConverter.PdfDocumentOptions.GenerateSelectablePdf
property on false. By default this property is true. If the property is true then
the issue must be caused by the IE9 installation. The version 7.0 of converter (and
the version 6.0 of the PDF Creator) should work well when the IE9 is installed.
However, when the converter runs in IIS under an identity which doesn't have an
user profile (like ApplicationPoolIdentity identity) it is possible to see this
issue even if the version 7 of the converter is used. The NetworkService identity
always has a profile and the converter should run well under this identity.
To resolve this issue you can either set Load User Profile on True in the pool Advanced
Settings in IIS or you can press the Configure button in the IE9Config utility to
get the same effect. You can find the IE9Config.exe utility in the Config folder
of the installation. The IE9Config utility must be executed as Administrator. To
do this you can select the executable file in Windows Explorer, right click on it
and select 'Run as Administrator' from the popup menu.
Important: After you have set the Load User Profile on True or you have pressed
the Configure button in the IE9Config utility you have to recycle the IIS pool or
restart IIS.
Another option you can consider is to upgrade from Winnovative HTML to PDF Converter
or PDF Creator to EVO HTML to PDF Converter
for .NET which is another product of our company advertised on the home
page of Winnovative website. There is also a link to upgrade from Winnovative to
EVO on the License Renewal web page.
EVO HTML to PDF Converter is not using IE as rendering engine and therefore does
not present the issue discussed in this section. Winnovative and EVO HTML to PDF
converters have very similar APIs and the migration should be fairly easy.
Q:
After I have installed IE9 some of the transparent PNG images are rendered blurred
in PDF and some of the table borders are rendered as black in PDF even if they have
a different color in the HTML document.
A: This problem occurs because of the IE9 rendering engine. The workaround for this
issue is to restore IE 8 on the computer where the converter runs.
Another option you can consider is to upgrade from Winnovative HTML to PDF Converter
or PDF Creator to EVO HTML to PDF Converter
for .NET which is another product of our company advertised on the home
page of Winnovative website. There is also a link to upgrade from Winnovative to
EVO on the License Renewal web page.
EVO HTML to PDF Converter is not using IE as rendering engine and therefore does
not present the issue discussed in this section. Winnovative and EVO HTML to PDF
converters have very similar APIs and the migration should be fairly easy.
Q: Can
the converter be used with on 64-bit Windows servers?
A: Starting with version 3.5 the converter can run on all 64-bit Windows versions
both in 64-bit mode and 32-bit WoW mode.
Q: Which versions of the .NET Framework does the converter support?
A: The converter can be used in applications targeting .NET Framework 2.0 or a later
version (.NET 3.0, 3.5, 4.0).
There are two distinct sets of of libraries and samples in the same installation
folder: for .NET CLR 2.0 (which is the runtime for .NET 2.0, .NET 3.0 and .NET 3.5)
and for .NET CLR 4.0 (which is the runtime for .NET 4.0). The samples for Visual
Studio 2005 and 2008 are targeting .NET CLR 2.0 and the samples for Visual Studio
2010 are targeting .NET CLR 4.0.
Grace to In-Process Side by Side (inproc SxS) feature of the .NET 4.0 CLR, the library
built for .NET 2.0 CLR can be used without change in applications targeting the
.NET 4.0 framework, but there will be a small overhead because .NET 2.0 CLR and
.NET 4.0 CLR will run side by side in the same process. So it is recommended to
use the library built for .NET CLR 4.0 in applications targeting the .NET 4.0 framework.
Q: Can
the converter convert HTTPS (SSL secured) URLs ?
A: In general, yes. There are a few situations when a HTTPS URL cannot be converted
to PDF. The most common situation is when using self-signed test SSL certificates
or invalid SSL certificates. When you are using a test certificate or an invalid
SSL certificate the IE browser will display a page containing an warning about an
invalid certificate being used. Similar to the browser behavior, the converter will
also fail to convert the web page when an invalid certificate is used to secure
the web page.
Other situation when the converter can fail is when various security restrictions
are set on your computer or in your network. For example we have found situations
when the firewall set in a network was blocking the access to the Certificate Revocation
List file (a file with .crl hosted on the certificate issuer website). The converter
was failing to retrieve the revocation list for the certificate and therefore the
whole conversion was failing.
We have found also situations when the network architecture was designed in such
a way that only computers from the Internet were allowed to access secured web pages
hosted inside the internal network while the accesses coming from clients inside
the internal network were rejected. To eliminate such a possibility you can try
to convert a secured web page from Internet like https://www.paypal.com .
There might other restrictions in your network, some of them based on the Windows
user credentials. If you can access a HTTPS web page from the IE web browser on
the server but the same URL is reported as inaccessible by the converter then you
can try to convert that URL using our Windows Forms sample application (in the Bin
folder of the installation). The IE web browser and the Windows Forms application
should run under the same Windows user account and should present the same credentials
in your network. If the conversion works from the Windows Forms application but
it's not working from an ASP.NET application then probably there is a restriction
somewhere based on the Windows user account and you should contact your network
administrator to learn more about the architecture of your network. The ASP.NET
applications run in general under a less privileged Windows account. You can try
to use a more privileged user account like NetworkService or even an Administrator
to run the IIS application pool of your website.
To avoid this kind of issues with HTTPS URL try to use HTTP instead HTTPS when this
is possible.
You can also consider to get the HTML string of the web page (as explained in the
next section) and set the base URL parameter to be a HTTP address if accessing the
images and the CSS style files by a normal HTTP address is possible. This way you
can have a secured access to the text in the web page while the access to images
and CSS files is not secured.
Q: How can I obtain the HTML string from a web page and convert it to PDF?
A: If you are trying to convert a ASP.NET page you can use the Server.Execute method
from to obtain the HTML string. Here is some C# code to obtain the HTML string from
a page of your application:
StringWriter sw = new StringWriter();
Server.Execute("PageToConvert.aspx", sw);
string htmlCodeToConvert = sw.GetStringBuilder().ToString();
You can also use the methods from ConverterUtils class that we
provide in the library to get the HTML code from a web page from Internet.
The converter library offers a set of methods for converting a HTML string to PDF.
See the AspNet_InvoicesDemo for a complete sample of how to retrieve
the HTML code and convert it to PDF.
Q: Is the ASP.NET session data available in the converted ASP.NET page during conversion?
A: The converter executes the web page to be converted in a new session
, different from the session in which your ASP.NET application runs. This basically
happens because the converter does not send the session cookie from the browser
back to the server. Therefore, the data currently stored in the session is not available
in the converter web page even if the page is part of your application.
See the InvoicesDemo sample application for ASP.NET for a complete
sample of how to retrieve the HTML code from a ASP.NET page, pass the session data
to the converted page and convert the HTML string to PDF. This application is also
installed as a live demo in our website.
Basically you have 2 options to consider when trying to overcome this situation
: to send the necessary data for loading the page to be converted in the query string
of the converted page URL or to get the web page HTML code using the Server.Execute(Url)
method as we do in the InvoicesDemo sample . The Server.Execute method is executed
in your application session so all the session data and existing authentication
should be valid.
When getting the HTML string with the Server.Execute(Url) method the resulted HTML
code should reference the external CSS, images and JavaScript code by a full
URL not by a relative URL. Here is some C# code to obtain the HTML
string from a page of your application:
StringWriter sw = new StringWriter();
Server.Execute("PageToConvert.aspx", sw);
string htmlCodeToConvert = sw.GetStringBuilder().ToString();
To instruct the converter how to automaticallt turn all the relative URLs into absolute
URL you have to pass the baseURL parameter of the convert function
with the full URL of the page from where you have taken the HTML string.
Q:
Does the converter use during conversion the session cookies stored in the current
web browser session when the converter is called from an ASP.NET application?
A: The session cookies stored by the browser are not automatically sent to the web
server by the converter when the converter is called from an ASP.NET page.
Starting with the version 5.4 of the converter it is possible to send custom HTTP
headers when a page is requested from the web server. A cookie can be sent to the
web server using such a custom HTTP header. The syntax to configure the converter
to send a cookie to the web server is:
pdfConverter.HttpRequestHeaders = String.Format(
"Cookie : {0}={1}; {2}={3}\r\n", cookieName1, cookieValue1, cookieName2, cookieValue2
);
Q: Does the HTML to PDF converter support authentication when used in ASP.NET application?
A: The converter offers support for server authentication, for example any type
of IIS authentication (Integrated Windows Authentication, Basic Authentication,
etc). To enable server authentication you have to set the PdfConverter.AuthenticationOptions
property with an username and password. The server authentication is usually necessary
when accessing Intranet resources.
Please do not confound the server authentication with the authentication implemented
at the level of your application (usually implemented as a login page in your application
). If you need to deal with application level authentication please read below.
Another option to consider when trying to resolve authentication issues (including
authentication implemented at application level) is to get the HTML code of the
web page using the Server.Execute(Url) method from ASP.NET and
then convert that string to PDF as we do in the InvoicesDemo sample for ASP.NET.
The Server.Execute() method is executed in your application session so all the session
data and existing authentication should be valid. However, the CSS files and images
referenced by the HTML code to be converted should be placed in a location which
doesn't require authentication.
See the InvoicesDemo application for ASp.NET for a complete sample
of how to retrieve the HTML code and convert the HTML string to PDF.
When getting the HTML string with the Server.Execute(Url) method the resulted HTML
code should reference the external CSS, images and JavaScript code by a full
URL not by a relative URL. Here is some C# code to obtain the HTML
string from a page of your application:
StringWriter sw = new StringWriter();
Server.Execute("PageToConvert.aspx", sw);
string htmlCodeToConvert = sw.GetStringBuilder().ToString();
To instruct the converter how to automatically turn all the relative URLs into absolute
URL you have to pass the baseURL parameter of the convert function with the full
URL of the page from where you have taken the HTML string.
Q: How can I control the page breaks in the resulted PDF document?
A: The HTML to PDF converter supports custom page breaks with standard CSS styles
like page-break-before:always and page-break-after:always
applied to any HTML object. These styles can be used either in a CSS class to be
applied to an element or inline in the element style attribute. It is not recommended
to use the page-break-after:always style on an empty element (like an empty DIV
tag). Instead you can use the page-break-before:always on an empty element to produce
the same effect.
The page-break-inside:avoid style can be applied to a element to
prevent splitting the content inside the element between PDF pages. The page-break-inside:avoid
style must be defined inline in the style attribute of the HTML element.
As previously mentioned, the page-break-before:always and page-break-after:always
styles are working even when they are defined in a CSS class to be applied to the
HTML element.
Q: How can I specify to the converter to not break (keep together on the same page)
a HTML region between PDF pages?
A: You can apply inline the page-break-inside:avoid
CSS style to the HTML element you want to keep appear in the rendered PDF document
on same page. Of course the element height must be less than the page height, otherwise
the style will be ignored by the converter. Please note that unlike the page-break-before
and page-break-after , the page-break-inside:avoid
style must be specified inline as in the example below:
<table>
<tr style="page-break-inside : avoid">
<td>
<img width="100" height="100" src="img1.jpg">
</td>
<td>
My text 1
</td>
</tr>
<tr style="page-break-inside : avoid">
<td>
<img width="100" height="100" src="img2.jpg">
</td>
<td>
My text 2
</td>
</tr>
</table>
In this example the table can contain a large number of rows, each row containing
an image in the left and a text in the right and we don't want such a row to span
on two pages. This can be easily achieved by specifying the page-break-inside:avoid
style inline for the table row.
Q: Some images are cut off between PDF pages? Is there any option to avoid this?
A: Set the PdfConverter.AvoidImageBreak property on true. By default this property
is false and the images might get cut off between PDF pages. You can also set the
page-break-inside:avoid CSS style inline on the IMG tag to achive the same result.
Q: How can I automatically repeat the header of a long HTML table on each PDF page
where the table is rendered?
A: Starting with the version 6.0 of the converter the HTML table header is automatically
repeated on each PDF page when the thead tag of the HTML table has the display:table-header-group
style. We provide the RepeatTableHeadOnEachPage sample in the installation
folder of the converter to demonstrate this feature.
Q: How can I exclude a HTML region from the rendered PDF document?
A: Starting with the version 6.0 you can instruct the converter to exclude a set
of HTML regions from conversion. In the generated PDF document there will be an
empty space in place of the excluded region.
The HTML elements to be excluded can be identified by the HTML IDs of the elements
or by the HTML tag names of the elements. The PdfConverter.HtmlExcludedRegionsOptions
object of HtmlExcludedRegionsOptions type is used to specify the excluded
regions. The HtmlExcludedRegionsOptions class has two properties
public string[] HtmlElementIds { get; set; }
public string[] HtmlTagNames { get; set; }
that can be used to define the HTML elements excluded by ID or by tag name.
In the example below the HTML elements with ID "printRegion1" or "printRegion2"
and all the "H1" elements will not be rendered in the generated PDF:
pdfConverter.HtmlExcludedRegionsOptions.HtmlElementIds = new string[] { "printRegion1", "printRegion2" };
pdfConverter.HtmlExcludedRegionsOptions.HtmlTagNames = new string[] { "H1" };
Q: Can the converter render a HTML string or an URL in the header and footer of
the generated PDF document?
Q: Is it possible to have different content in the header (or footer) of different
PDF pages?
Q: How can I add many HTML documents into the same PDF document?
A: Starting with version 5.1 it is possible to add many HTML documents to the same
PDF document using the PostConvertActionEvent feature and we provide the MultipleHtmlConversions
sample both for ASP.NET and Windows Forms to show how to do this. The first document
is added to PDF using the usual methods like GetPdfBytesFromUrl() or GetPdfFromHtmlString().
The other documents are added in the PostConvertActionEvent handler as HtmlToPdfElement
objects. You can add a HtmlToPdfElement on a new PDF page or you can continue right
after the point where the rendering of the first HTML document ended. The 'Start
second URL conversion on a new PDF page' checkbox in the sample application controls
this. You can find where the first document finished rendering from the ConversionSummary
property of the argument passed to the event handler. If you want to add many HtmlToPdfElement
objects one after the other, you can find where a HtmlToPdfElement finished rendering
from the AddElementResult object returned as result of adding the HtmlToPdfElement
object to the PDF page and you can start the next HtmlToPdfElement object from that
position.
In version 6.0 a new set of methods was added to allow obtaining a Document object
after conversion. PdfConverter.GetPdfDocumentObjectFromUrl() and PdfConverter.GetPdfDocumentObjectFromHtmlString()
are part of this set of methods. While the PostConvertActionEvent mechanism is still
funtional, the new set of methods is now the preferred way of getting a Document
object and all our samples were updated to use this new set of methods.
Q: Can I disable the HTTP links from the generated PDF document?
A: The PdfConverter.PdfDocumentOptions.LiveUrlsEnabled controls the rendering of
http links in the resulted PDF document. By default this property is true.
Q: What type of fonts does the converter support and how can I embed the fonts in
the generated PDF document?
A: The converter supports any true type font preinstalled in Windows operating system.
It also supports the open type fonts with the condition that the open type font
has TrueType outlines not PostScript outlines. To check what type of outlines has
an installed font, you can open the font from the Fonts folder in Control Panel.
When a font is not supported by the converter the MS Sans Serif font is used by
default.
The converter also supports custom true type fonts you can install from a .ttf or
a .otf file. After you have installed a font it becomes available only for the currently
logged in Windows user who installed the font. In order to make the font available
for all the users, including the ASP.NET user in the case you are using the converter
from an ASP.NET application, you have to reboot the computer after font installation.
To embed the true type fonts in the generated PDF you have to set PdfConverter.PdfDocumentOptions.EmbedFonts=true.
By default this property is false. The same property is also available in the HtmlToPdfElement
class defined by the PDF Creator and HTML to PDF Converter libraries.
Q: I installed a true type font on the server but the converter is still using a
default font instead of the installed font.
First make sure that you restarted the server after true type font installation.
After you have installed a font it becomes available only for the currently logged
in Windows user who installed the font. In order to make the font available for
all the users, including the ASP.NET user, in case you are using the converter from
an ASP.NET application, you have to restart the server after font installation.
If the server restarting didn't solve the problem then make sure you installed a
supported type of font. The converter supports any true type font preinstalled in
Windows operating system. It also supports the open type fonts with the condition
that the open type font has TrueType outlines not PostScript outlines. To check
what type of outlines has an installed font, you can open the font from the Fonts
folder in Control Panel. When a font is not supported by the converter the MS Sans
Serif font is used by default.
Another situation when the default font is used occurs when the style used for a
font is not supported by that font. The true type fonts have separate glyphs for
different styles. For example a font can have separate glyphs for the normal, italic
or bold styles. Some fonts can support only the normal style other fonts can support
only the italic style. You have to use only the styles supported for a true type
font. You can see what styles are available for a font in the Fonts folder of the
Control Panel. If a font does not have the required style the converter first tries
to use a supported style and if it is not possible then a default font is used.
Q: The Unicode characters are not displayed or they are incorrectly displayed for
some fonts.
Each true type font has a table of supported unicode characters. If you are trying
to use a font for a Unicode text for which the font does not have associated glyphs
the displayed text in PDF will be incorrect. You always have to make sure that the
font used for a Unicode text supports the language of that text.
The web browser can display the text even if the specified font is incorrect because
the web browser can automatically substitute incorrect fonts with supported fonts,
but the converter does not have this ability.
Q: Does the converter support right-to-left and complex script languages (Arabic,
Hebrew, Indic, Thai, etc) and East Asian languages (Chinese, Japanese, Korean)?
Yes, the HTML to PDF Converter and the PDF Creator support all these types of languages.
If you have a Windows XP or a Windows Server 2003 computer you have to make sure
that the Windows support for these languages is enabled. You can do this by checking
on the checkboxes 'Install files for complex script and right-to-left languages'
and 'Install files for East Asian languages' in the 'Languages' tab accessible from
Windows Control Panel under 'Regional and Language Options' section. After installing
the files for these languages you'll be asked to reboot the server.
For Windows Vista, Windows Server 2008 and later Windows versions the support for
these languages is enabled by default.
Q: How can I control the images quality in PDF?
A: By default the the converter is using JPEG to compress images in PDF and to reduce
the size of the generated PDF document. The compression level of the images is controlled
by the PdfConverter.PdfDocumentOptions.JpegCompressionLevel property. When the JpegCompressionLevel
is 0, the compression rate is the lowest and the quality of the images is the best.
When the JpegCompressionLevel is 100, the compression rate is the highest and quality
of the images in PDF is the worst. The default JPEG compression level is 10, which
should offer a good balance between the compression rate and the quality of the
images in PDF.
It is also possible to completely disable the JPEG compression and store the images
as bitmaps in PDF if you set PdfConverter.PdfDocumentOptions.JpegCompressionEnabled
to false. This produces the best quality of the images but the generated PDF document
can be very large and the conversion process is slower.
Q: The JavaScript code from HTML page is not executed during conversion. How can
I activate JavaScript code execution during conversion?
A: The PdfConverter has the following properties controlling the JavaScript, Java
Applets and ActiveX download and execution during conversion: ScriptsEnabled, ScriptsEnabledInImage,
ActiveXEnabled, ActiveXEnabledInImage. By default these properties are false which
means the JavaScript code is not enabled during conversion. To activate JavaScript
simply set PdfConverter.ScriptsEnabled = true when converting to PDF with selectable
text or set PdfConverter.ScriptsEnabledInImage = true when converting to PDF with
embedded image.
If you already set the PdfConverter.ScriptsEnabled on true and the JavaScript code
is still not executed it means the Internet Security Settings on your server don't
allow the JavaScript execution. JavaScript code could work when you load the page
in Internet Explorer because the browser runs under the currently logged in user
and for this user the JavaScript execution is allowed by the Internet Security Settings
for the security zone of the page you are trying to convert. When you run the converter
from an ASP.NET application the JavaScript execution might not be allowed for the
ASP.NET user and for the security zone of the web page you are converting. A simple
thing you can do is to move the web page in a more permisive Internet Security Zone
like Local Machine. You can achieve this if you set the PdfConverter.InternetSecurityZone
property with the InternetSecurityZone.LocalMachine value. If it's still not working
you might have to modify directly into the Windows Registry the ASP.NET user Internert
Security profile to allow JavaScript execution. The following technical article
from Microsoft shows how to configure the internet security zones registry, including
the JavaScript and ActiveX execution.
Internet Explorer security
zones registry entries
The key 1400 in each security zone should be set to 0 both in HKEY_LOCAL_MACHINE
and in HKEY_USERS for the user running the converter. After you have modified the
registry you have to reboot the computer to make sure the new configuration is applied.
Q: The Flash, Silverlight and other ActiveX controls are not rendered in the PDF
document. Is there any option I should set?
A: The Flash images and movies are rendered by an external flash player which is
an ActiveX control. First you have to make sure a flash player is installed on your
server and the flash image or movie is displayed when the web page is loaded in
the IE browser running on your server without any warnings. Then you have set the
PdfConverter.ActiveXEnabled=true when converting to PDF with selectable text or
PdfConverter.ActiveXEnabledInImage=true when converting to PDF with embedded image.
Please note that the converter could automatically switch to a PDF with embedded
image when ActiveXEnabled property is true. Sometimes the ActiveX control are written
in HTML using JavaScript. In this case the JavaScript execution should also be enabled
during conversion as explained in the answer to the previous question.
If you already activated ActiveX controls during conversion but your flash image
still doesn't appear in PDF or is empty then this probably happens because
the flash control did not finish to initialize the image when the converter detected
the web page was completely loaded. You can try to manually set a delay before starting
the PDF conversion using the PdfConver.ConversionDelay and setting it to a small
value in seconds (you can start with a 3 seconds delay for example).
Another situation when the Flash, Silverlight and other ActiveX controls are not
rendered in PDF is when the converter runs in a 64-bit process. Currently there
is not a Flash or Silverlight player for 64-bit environments and therefore the Flash
and Silverlight controls are not rendered to PDF. The situation can be similar for
other ActiveX controls. The workaround is to build your Windows Forms application
for X86 target in Visual Studio or, if you are using the converter in an ASP.NET
application, to put the IIS pool in 32-bit mode.
If the flash images still don't appear in PDF it means the Internet Security Settings
on your server don't allow the ActiveX execution. The ActiveX can work when you
load the page in Internet Explorer because the browser runs under the currently
logged in user and for this user the ActiveX execution is allowed by the Internet
Security Settings for the security zone of the page you are trying to convert. When
you run the converter from an ASP.NET application the ActiveX execution might not
be allowed for the ASP.NET user and for the security zone of the web page you are
converting. A simple thing you can do is to move the web page in a more permisive
Internet Security Zone like Local Machine. You can achieve this if you set the
PdfConverter.InternetSecurityZone property with the InternetSecurityZone.LocalMachine
value. If it's still not working you might have to modify directly into the Windows
Registry the ASP.NET user Internert Security profile to allow ActiveX execution.
The following technical article from Microsoft shows how to configure the internet
security zones registry, including the JavaScript and ActiveX execution.
Internet Explorer security
zones registry entries
The key 1200 in each security zone should be set to 0 both in HKEY_LOCAL_MACHINE
and in HKEY_USERS for the user running the converter. After you have modified the
registry you have to reboot the computer to make sure the new configuration is applied.
Q: Sometimes the asynchronous content like an AJAX update panel or a Flash image
is not rendered in PDF. Is there any option to wait for this content to be completeley
loaded before rendering the PDF?
A: The PdfConverter class (and the HtmlToPdfElement class in PDF Creator library)
has a ConversionDelay property which can be used to specify an additional period
of time in seconds to wait for asynchronous content to be loaded before starting
PDF rendering.
Q: Which Adobe Reader versions can read the generated PDF documents?
A: The converter generates PDF documents in conformance with PDF 1.4 specification.
This specification is fully supported starting with Adobe Reader 5.0.
Q: Can I open the generated PDF document directly into a browser window instead
of displaying the Open/Save dialog in browser?
A: Instead of the code from our samples which sends the PDF bytes to the browser
as an attachment you can use the following code to open the generated PDF document
inline:
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Type", "application/pdf");
response.AddHeader("Content-Disposition",
"inline; filename=" + downloadName + "; size=" + downloadBytes.Length.ToString());
response.Flush();
response.BinaryWrite(downloadBytes);
response.Flush();
response.End();
Q: How can I execute a JavaScript code (Acrobat JavaScript) when the PDF document
is opened in the viewer?
A: You can use the Document.OpenAction.Action property to set a PdfActionJavaScript
object representing the JavaScript code you want to execute when the PDF document
is opened in the viewer. For example you can use the code below to display an alert
message when the document is opened:
document.OpenAction.Action = new PdfActionJavaScript("app.alert('Hello');");
The document object is either the Document instance created by your application
when using the PDF Creator product or a Document object produced by the HTML to
PDF library when using a method like PdfConverter.GetPdfDocumentObjectFromUrl().
Q: How can I make a PDF viewer to open the generated PDF document at a specified
zoom level?
A: This can be done by executing a Acrobat JavaScript code (see the previous question)
when the document is opened. For example, the Acrobat JavaScript code to make the
PDF document to be opened by default at 100% zoom level is :
document.OpenAction.Action = new PdfActionJavaScript("this.zoom=100;");
The document object is either the Document instance created by your application
when using the PDF Creator product or a Document object produced by the HTML to
PDF library when using a method like PdfConverter.GetPdfDocumentObjectFromUrl().
Q: How can I make the PDF viewer to automatically go to a specified page when the
PDF document is opened in the viewer?
A: You can use the Document.OpenAction.Action property to set a PdfActionGoTo object
representing the destination displayed when the PDF document is opened in the viewer.
For example you can use the code below to automatically go to the second page in
document when the document is opened in the PDF Viewer:
document.OpenAction.Action = new PdfActionGoTo(new ExplicitDestination(document.Pages[1],
new PointF(0,0)));
The document object is either the Document instance created by your application
when using the PDF Creator product or a Document object produced by the HTML to
PDF library when using a method like PdfConverter.GetPdfDocumentObjectFromUrl().
Q: How can I append external PDF documents to the PDF document resulted after conversion?
A: You can add external PDF files and streams to the conversion result using the
AppendPDFFile, AppendPDFFileArray, AppendPDFStream and AppendPDFStreamArray properties
of the PdfConverter.PdfDocumentOptions. You can find a full sample of how to use
these properties under the 'WinForms_PrependAppendExternalPdfs' sample from the
downloaded archive. If you need more flexibility in merging conversion results with
external PDF documents then you can try our PDF Merge library which is a separate
product.
Starting with version 6.0 of the HTML to PDF Converter it is possible to create
a Document object from an external PDF document and append it to the Document object
created by a call to a method like GetPdfDocumentObjectFromUrl() as we do in the
code sample below. A similar code can be used with the PDF Creator product to append
external PDF documents instead of using the MergePdf class.
// call the converter and get a Document object from URL
Document pdfDocument = pdfConverter.GetPdfDocumentObjectFromUrl("http://www.winnovative-software.com/");
// create a stream from a PDF file
System.IO.FileStream pdfStreamToAppend = new System.IO.FileStream(@"C:\external_document.pdf",
System.IO.FileMode.Open);
// create the Document object based on the file stream
Document pdfDocumentToAppend = new Document(pdfStreamToAppend);
// append the PDF document from stream to the current PDF document
pdfDocument.AppendDocument(pdfDocumentToAppend);
// close the stream
pdfStreamToAppend.Close();
// save the final PDF document to a file or to a stream
try
{
pdfDocument.Save(outFilePath);
}
finally
{
// close the Document to realease all the resources
pdfDocument.Close();
}
Q: How can I specify a custom PDF page size for the generated PDF document?
A: Starting with version 3.2 of the converter you can set the PdfConvert.PdfDocumentOptions.PdfPageSize=PdfPageSize.Custom
and in this case the custom size of the PDF page will be taken from PdfConverter.PdfDocumentOptions.CustomPdfPageSize
property where you can specify the width and height of the PDF page in points.
Q: How can I use the HTML to PDF converter library from .NET 1.1 applications or
from PHP applications?
A: The HTML to PDF converter library is a .NET 2.0 or 4.0 library and it is not
working with .NET 1.1 directly. The workaround for this is to download and install
our HTML to PDF Converter Bridge Web
Service which exposes a simple method to return the rendered PDF document
bytes from a specified URL. The web service internally makes calls to the converter
library.
The downloaded archive also contains a ASP.NET 1.1 and a ASP.NET 2.0 test web sites.
The bridge web service must be installed on your server as any .NET 2.0 web service.
Most of the Windows servers today have the .NET 2.0 already installed or you can
download and install the
.NET Framework 2.0 Redistributable package for free from Microsoft web site.
To install our html to pdf converter web service on your server you have to create
a virtual IIS folder named ConvertWebService for the ConvertWebService folder from
the downloaded archive (the simplest way to do this is to right click on the folder
and from the Properties page select the Web Sharing tab). Then you have to make
sure that the web service runs under ASP.NET 2.0 in IIS and also make sure the security
settings allows you to access the web service from your application. From the IIS
right click on the ConvertWebService web site and edit the Directory Security and
ASP.NET tabs.
Then all you have to do is to add a reference to the web service in your .NET 1.1
application and call the web service render method. You can extend our sample web
service with other methods allowing you to specify more options for the converter.
Note: Another possible solution is to create a .NET 2.0
command line tool to be called from your application but there might be some additional
overhead with this approach to execute the command line and retrieve the generated
PDF document. We provide a sample console application Console_HtmlConvertDemo_CS
in the HTML to PDF Converter archive that might be a good starting point.
Q: How do I perform a conversion to Landscape page orientation?
A: Use the following property:
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
Q:
When I converted a web page containing a frameset tag only the top part of the page
was rendered in PDF.
A: This indicates the converter was not able to correctly determine the height of
the web page. The work around is to explicitly set the web page in pixels or to
convert directly the web pages referred by the frameset frames. For example you
can set pdfConverter.PageHeight = 2000;
Q: Can I deploy my ASP.NET application using the HTML to PDF Converter on a shared
server?
A: The converter requires Full Trust level for the ASP.NET application calling it.
The default trust level for an ASP.NET applications is Full Trust but the shared
hosting providers usually modify the trust level to Medium Trust which makes our
converter to not run properly in such environments. In order to solve this issue
you can ask you shared hosting provider to give Full Trust level for you ASP.NET
application. Another possibility is to create a ASP.NET web service around the converter
library, install that web service on a machine where the full trust is allowed and
call the web service from your application. You have to ensure that the web service
you create can be used only from your application.
Q: When I try to add a digital signature to the generated PDF document using a certificate
from a PFX file I get the 'Could not generate digital signature' error.
A: First make sure that the PFX file contains the private key. If the private key
is present in the PFX file then it might be possible that the certificate from the
PFX file is not compatible with some Windows API functions used by our library.
In this case you can import the certificate from the PFX file into Windows certificates
store and then re-export it into a new PFX file. This new PFX file should be compatible
with the Windows API and the exception should disappear. To import the PFX file
into Windows certificates store you can double click the PFX file and check on the
'Mark this key as exportable. This will allow you to back up or transport your keys
at a later time' option. To export a PFX file containing a certificate you can open
the certificates store using IE. From Tools->Internet Options->Content choose Certificates
and locate the certificate you have just imported. Press Export button and choose
'Yes, export the private key' option and set a password for opening the generated
PFX file.
Q:
The exception "Could not get image from url. Could not initialize the html converter
object.Request failed.." or the exception "Required permissions cannot be acquired."
or the exception "Operation could destabilize the runtime" is thrown during the
HTML to PDF conversion.
A: The converter needs a full trust level for your ASP.NET application in order
to correctly execute. The default trust level is full but some of the hosting providers
set this to medium or lower. The trust level can be set in the Web.config of the
application ( <trust level="Full"/> under the <system.web> config section
) but the hosting provider could also forbid overriding the trust level from the
web site configuration file.
If your application already has full trust that means more security restrictions
are imposed by the Windows to the assembly. Adding the assembly to the GAC (Global
Assembly Cache) usually makes the assembly more trusted and solves the problem.
A special situation when this exception can occur is on Windows Vista family of
operating systems (Windows Vista SP2, Windows 7). When you download the assembly
from Internet the operating system marks the file as "Blocked". You can check the
assembly was blocked if you right click on the file in Windows Explorer and select
Properties. At the bottom of the Properties tab there should be an "Unblock" bottom
if the assembly was blocked and the message "This file came from another computer
and might be blocked to help protect this computer" should be displayed near that
button. To unblock the assembly and allow its execution simply click the "Unblock"
button and restart the IIS application pool of your application to make sure the
change was applied.
Another solution in this situation is to change the identity of the IIS pool of
your application to a less restrictive account. The Network Service account should
normally allow the execution of the assembly.
Q: The
HTML to PDF converter throws the following exception: "HtmlConvertException: Could
not generate the PDF document. Could not get image from url. Could not initialize
the html converter object. Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))."
A: This error indicates the WebBrowser control could not access the COM interface
of the Internet Explorer. You can try to use the dcomcnfg utility to allow the user
running the application to access the interface. In Start->Run type dcomcnfg and
under Component Services -> Computers -> My Computer -> DCOM Config select Internet
Explorer. Right click on it and from tabbed properties select Security. To customize
the access permissions select Customize radio button and give access to the user
running the application ( for ASP.NET this should be the IUSR_{MACHINE_NAME} if
your application is using impersonation to execute )
Sales Questions and Answers
Q: What is the difference between a deployment and a redistributable license?
A: A deployment license can be used in a single application that can be deployed
on a single server and it doesn't include any maintenance like technical support
or software updates. Also, when the deployment license is used for development,
only a single developer can use that license.
A redistributable license can be used in an unlimited number of application that
can be deployed on an unlimited number of servers and it can be used by an unlimited
number of developers inside your company. A redistributable license can be distributed
as part of your software with the condition to protect the license key in the compiled
code of your application or to store the license key in an encrypted format out
of the compiled code of your application. When you purchase a redistributable license
key you also get free full maintenance for the first year including priority technical
support and minor and major version updates for the software.
A full description of the license types can be found on the Buy Now
web page of our website.
Q: What type of payment methods do you support?
A: We are using ShareIt as payments provider
to fully manage our sales. ShareIt is owned by
Digital River, a global leader in e-commerce solutions. ShareIt is headquartered
in Europe (Germany). They support a complete spectrum of payment methods. You can
pay by any type of credit card, check or wire transfer. For any inquiries you might
have you can contact ShareIt directly and they should help you as soon as possible.
Q:
What do you deliver after purchase?
A: We are using ShareIt as payment provider
to fully manage our sales. ShareIt is owned by
Digital River, a global leader in e-commerce solutions. ShareIt is headquartered
in Europe (Germany).
After a purchase order is successfully processed by one of our payment providers
you'll receive by email a license key string for the product. In order to get the
license key you have to make sure that the emails from ShareIt are not blocked by
any spam filter you might have on your computer or in your network.
We don't do any physical delivery like DVDs or printed material.
Q: Do you have any discounts for resellers?
A: We offer a 20% discount when a reseller buys a 5 licenses pack in advance. We
don't have any discounts for a single license.
The resellers have the obligation to register to us the information about each license
they resell. If you are interested in becoming our reseller under the terms and
conditions described above please contact our support team for more details.
Q: Do you have any discounts for non-profit organizations?
A: We don't have special prices for a non-profit organizations.
Q: Are the licenses for your products royalty free?
A: Yes, all our license types are royalty free. A purchased license will work with
the version of the product for which it was purchased for an unlimited period of
time and you can use it under the licensing terms and
conditions without any additional fees.
Q: Under which circumstances I can distribute your component as part of my application
to my own clients?
A: First you need to purchase a redistributable license. Then you have to protect
the license key string that you received after purchase either by including it in
the compiled code of your application or by storing it in an encrypted format. You
also have to clearly specify in the terms and conditions of your application that
the usage of our component outside the functionality your application is illegal.
Finally you have to make sure (by contacting our support or sales team directly)
that your application does not compete with our products and the usage of our component
is fully compliant with the terms and conditions from our
license agreement
Q: What refund policy do you have?
A: In general we don't accept refund requests for Winnovative Software products.
The reasons for this decision are:
- All of our evaluation versions are fully functional
- You can evaluate our products for an unlimited period of time
- The products are well documented and we offer fully functional samples with full
source code to get started with the product
- We offer free technical and sales support by email during the evaluation period
and after the product purchase
- We encourage you to completely test our products both in development and production
environments to see if they entirely meet your expectations before making the purchase
decision
If you think there are any special circumstances for requesting a refund, please
write us to
support@winnovative-software.com
and provide us with the details about the situation. We'll try to analyze your request
as soon as possible.