gmanny / Pechkin

.NET Wrapper for WkHtmlToPdf static DLL. Allows you to utilize full power of the library.
400 stars 128 forks source link

Dynamically generated images without file extension #15

Open bUKaneer opened 12 years ago

bUKaneer commented 12 years ago

Firstly - thank you for creating such a great tool it really is astounding. My issue relates to calling a PNG using an tag with the https protocol. I've tried working around the issue and have posted this question on stack overflow (see link below) to show an example of what Im doing.

From my reading around both wkHtmlToPdf and your port it seems like this may well not be supported presently - if this is the case could you just post a quick answer confirming so that I can proceed with my implementation in a different direction (i.e. Ill stop looking for a solution and try to work around the problem a differrent way!).

http://stackoverflow.com/questions/13267838/pechkin-html-to-pdf-that-includes-a-link-to-a-png-from-an-ssl-url

\ UPDATE / SUMMARY ***

After much help from gmanny we discovered that SSL was not the issue - rather the issue concerned images that have no extension for example dynamically generated barcode images from something like barbeque java library. Items will not be rendered if they are referenced using this type of link:

http://somehost/somepath/somefile?data=0123456789

A work around can be used to accommodate this shortfall by pre-processing the links, making individual WebRequests for the image with an extension, storing them on your local server (somewhere within the site root) and then replacing the original extentionless urls with links to the pre-downloaded images with extensions.

@gmanny has offered to look into this problem at some point ;o) Thx @gmanny !

gmanny commented 12 years ago

Tried it with

<img src="https://static.e-junkie.com/sslpic/83912.fce97b5f0e32f8c0ec83771330892973.jpg" />

and it succeded. Options like here.

gmanny commented 12 years ago

Also this code also have worked:

<img src="https://static.e-junkie.com/sslpic/83912.fce97b5f0e32f8c0ec83771330892973.jpg?hello=world&testing=here" />

I did it from WinForms, but I think it's not relevant.

gmanny commented 12 years ago

Could you please try this URL and tell me, if it works for you, or not?

bUKaneer commented 12 years ago

Will do when I'm back in the office tomorrow - thanks for taking the time to look into this, very much appreciated.

gmanny commented 12 years ago

Thank you for posting, and sorry for the delay. Looking forward for hearing the results :)

bUKaneer commented 12 years ago

Hey @gmanny thanks for taking the time to look into this - OK I tried the examples and sure enough they worked - only differences I can see with URLs is that I dont at any point have a file extension and the file is a png not a jpg.

My URLs (theyre not actually MY urls its a system I have no control over) look a bit like this:

https://domain.com/somepath/getFile?data=012345

I'm wondering if its an extension related problem now?

gmanny commented 12 years ago

Could you please perform one more test: just open HTML page you're trying to render with chrome and tell me, if images there are displayed correctly?

bUKaneer commented 12 years ago

Ah yes, no need to write a test for that - it pushes the HTML to screen and then renders the PDF for reporting purposes ;o) HTML is rendering perfectly (as is the PDF except this one image). Chrome is my default browser too,

gmanny commented 12 years ago

Okay, I'll test this more, but I need to set up some ssl hosting first, so it'll take some time. Good that you already have a workaround :)

bUKaneer commented 12 years ago

Thanks so much for taking this on board ;o) No worries, the work around means its no a massive problem time wise (always more than one way to skin a rabbit as it were) but it would be awesome to know what the root cause is.

I do hope it not something stupid I've done but I've tried to cover all the bases before hastling you! I know time is precious which is why I'm very grateful indeed and have tried to chip in on other posts where I can to help out a bit.

gmanny commented 12 years ago

Thank you too :) Will keep you posted.