2

I'm currently using in my project TuesPechkin version 2.1.1, and also TuesPechkin.Wkhtmltox.AnyCPU v0.12.4.1

This is some of my code:

byte[] result = null;
 try
 {
 var globalSettings = CreateGlobalSettings(portraitMode);
 var objectSettings = CreateObjectSettings(websiteUrl, urlParameters);
 var document = new HtmlToPdfDocument
 {
 GlobalSettings = globalSettings
 };
 document.Objects.Add(objectSettings);
 CreateEventLog.CreateInformationLog("Ready to convert PDF");
 result = Converter.Convert(document);
 CreateEventLog.CreateInformationLog(result == null
 ? "Conversion failed using the Pechkin library"
 : "PDF conversion finished");

I run this code in 3 different environments:

  1. On my local machine it runs fine and it generates the file in 3 seconds.
  2. On one of my servers (let's call it Server A) it runs fine and it generates the file in 3 seconds.
  3. On the other of my servers (let's call it Server B) it holds for 1min (for some reason I don't understand) during the Converter.Convert part, and after that minute it returns null.

Server A and Server B have the same setup (CPU, RAM, etc) There's no peak increase on Server B during conversion.

Any suggestions/ideas?

Hien Nguyen
  • 24,551
  • 7
  • 52
  • 62
Rui Piloto
  • 31
  • 3

2 Answers2

1

I found what the issue is.

The URL I'm trying to convert is in a Presentation Layer, which is deployed in a separate server. Pechkin converter is in a Business Layer.

In Server A, I can access the URL from the Business Server. In Server B, I cannot access the URL from the Business Server.

This is probably some firewall exception that needs to be created.

It would be nice though to have TuesPechkin, returning an error saying it cannot access the URL.

Rui Piloto
  • 31
  • 3
0

It is important to check how you get the convert, dispose issue may cause problem Just check code form here

public static IConverter GetConverter()
{
    lock (Locker)
    {
    if (converter != null)
        {
            return converter;
        }

        var tempFolderDeployment = new TempFolderDeployment();
        var winAnyCpuEmbeddedDeployment = new WinAnyCPUEmbeddedDeployment(tempFolderDeployment);
        IToolset toolSet;
        if (HostingEnvironment.IsHosted)
        {
            toolSet = new RemotingToolset<PdfToolset>(winAnyCpuEmbeddedDeployment);
        }
        else
        {
            toolSet = new PdfToolset(winAnyCpuEmbeddedDeployment);
        }

        converter = new ThreadSafeConverter(toolSet);
    }

    return converter;
}
Max CHien
  • 133
  • 1
  • 8