Reputation: 31
For a project, we are migrating to Windows Azure. I have to make sure that the HTML to PDF converter will run on a 64 bit worker role.
Since Pechkin can't run as a 64bit application I have decided to use Tuespechkin, because they should be very alike and both use wkhtmltopdf to convert the HTML to PDF.
Now, i got this all set up but the resulting PDF is kind of disappointing.
Problems:
The font is rendered differently. With Pechkin the font is always 'sharp' where tuespechkin makes it very bold. Results here: http://postimg.org/image/xngqxryn1/
All contents is selectable and copyable. I would like it to be more like an image (which is default in pechkin). Any advice on this would be appreciated.
Here is the code i am using to convert the HTML to PDF:
Pechkin, old:
var documentConfig = new ObjectConfig()
.SetAllowLocalContent(true)
.SetLoadImages(true)
.SetRunJavascript(true)
.SetPrintBackground(true)
.SetRenderDelay(15000);
var globalConfig = new GlobalConfig()
.SetMargins(new Margins(50, 50, 100, 100))
.SetDocumentTitle(company.Name)
.SetPaperSize(PaperKind.A4);
var pechkin = new SynchronizedPechkin(globalConfig);
var buffer = pechkin.Convert(documentConfig, parsedHtml);
Tuespechkin:
var converter = new ThreadSafeConverter(
//new ImageToolset(
new PdfToolset(
new Win64EmbeddedDeployment(
new TempFolderDeployment()
)
)
);
var documentConfig = new ObjectSettings {
WebSettings = new WebSettings {
EnableJavascript = true,
PrintBackground = true,
PrintMediaType = true
},
LoadSettings = new LoadSettings {
BlockLocalFileAccess = false,
RenderDelay = 15000,
},
HtmlText = parsedHtml
};
var globalConfig = new GlobalSettings();
globalConfig.Margins = new MarginSettings(2.645833333333, 1.322916666667, 2.645833333333, 1.322916666667);
globalConfig.Margins.Unit = Unit.Centimeters;
globalConfig.DocumentTitle = company.Name;
globalConfig.PaperSize = PaperKind.A4;
globalConfig.UseCompression = false;
globalConfig.DPI = 1200;
var doc = new HtmlToPdfDocument {
Objects = {
documentConfig
},
GlobalSettings = globalConfig
};
var buffer = converter.Convert(doc);
Any help on either problem would be much appreciated!
Upvotes: 1
Views: 5634
Reputation: 44
As you say, I can't solve the problem. But IIS can be set to run 32-bit applications. as this photo: https://i.sstatic.net/6l6Es.png
So you can run Pechkin in you Azure. You can see more in this. https://codeutil.wordpress.com/2013/09/16/convert-html-to-pdf/
Upvotes: 0