« first day (2445 days earlier)      last day (2520 days later) » 

11:00 AM
Hmm, okay
 
You can even XSLT it.
 
Because right now we are creating a table with data defined from a database
With tons of loops and generally rather twisted around code
Using Altova's XMLSpy we can create a PDF using Raw XML data we created on another page, where we just manually create the XML tags
 
Just take the database-data, put it into a POCO, iterate over the POCO, generate a HTML table, take the HTML, generate a PDF. Yes, it's a few steps, but it's clean and isolated.
 
However, we'd need something easier for the user. I figured it would be easier to use the XML data we got and convert it to a PDF, but I guess not?
 
How is the user involved?
 
11:02 AM
The user sees a form where they can view, edit and lock data
If the user wishes, they need it as a PDF, essentially
Using the browsers save-as function isn't an option
 
So why is XML needed at all?
 
We've earlier used it to create the PDF in Altova XMLSpy, like I mentioned earlier
But now that we get closer to a production stage, we need to start phasing that method out
 
So if you don't need the XML, think YAGNI.
 
I just figured HTML -> XML ->PDF would have been easier than HTML -> PDF
 
No way. Just use HTML->PDF with something like Phantom.
 
11:04 AM
As I feel like data in XML is easier to transform through XSLT than data in HTML
 
Browsers are pretty good today, and there are a LOT of headless-browser using chrome with its built-in PDF exportation capabilities.
Data -> HTML is where view engines come in, e.g. Razor.
Since the web is such a huge thing, we're literally swamped with options there.
 
So if we were to do HTML to PDF
How do we modify what it looks like in the PDF, as the PDF has a different format than a web page?
 
If you don't mind me asking, why not just create a PDF right from the data?
 
1) Not sure how
But more importantly,
 
It doesn't, really. PDF is essentially nothing more than an encapsulated well-defined format for presentation elements. You don't 'modify what it looks like in PDF', you create a HTML with the well-defined width of your target PDF and adjust it so that it looks good.
 
11:07 AM
There are plenty of reporting engines that can take data and generate a PDF report from it.
 
If reporting is your deal, then reporting services can work yeah.
 
2) We got navbars, footers, side content etc on the main view we don't want in the PDF
 
If it needs be somewhat customized, HTML is a good way to go.
Look, man, you create a seperate HTML/CSS/whatever for PDF.
Or you use CSS to hide elements (but this takes more effort)
 
CSS has media-queries for that, doesn't it?
 
Hmm, okay, I can see how that's viable
 
11:08 AM
Yeah, CSS has print styles for PDF/printing.
 
Chances are, your HTML views have other elements that shouldn't be in the output PDF, unless you want it to feel like a screenshot, not a first-class output format.
Buttons, small UI affordances, borders that help you find the right place to click.
 
Screenshots are possible but kind of silly to put in a PDF
 
I'll have to take a look at that then! Cheers for throwing me back in the right direction.
I'll have to go afk for a moment but thanks nonetheless! Will probably pop up more questions regardign it eventually.
 
!!zalgo I dont wanna do work
 
@KamilSolecki I͓͚͔͍̺̙͎̙͗͆̈́͛ ̙ͫͬ͑͋̅ͮ͑́́́d͗ͨ̐̓҉̦̠o̗͎̙͔̱̺͍̹͋ͯ́ͅn̵̞̑̐̃ͤ́ẗ̨̠̘̠͎̲̯͎ͭͭ̆͒̒͆ͧ͟ͅ ͚͙̙ͩͨ͛̿͡w̺̣͚̰̘̣̜͎͍̏̅͂a̔̇́̕͏̺̘̪̰̳̻̦̳̭ņ̲̰ͬ͑̌͗ͯ̚n̡̛̤͚͚͔͚̩ͭͪͬ͑͝a̵̲͈͈̻ͪͤ̓ ̦̞̫͑ͬ̑ͭ͒ͥd͍̳̜̤̰͙̟ͯͨ̏͐ͨ̍́ͅȯ͔͇̮̠̮̔̌ͥ̚̕ ̴̨̨̖͙͖̦͖̏͐ͥ̀̃̀̔w̦͕͖̒̃̄̕͢oͯ̈́̃ͧ͟҉̨̻̦̝͕̻r̷ͧͭ̍͆ͥͭ͑ͣ͏͇̤̙͚k̵͖̮̰̠̑̓͢͠
 
11:15 AM
!!you always understand me, cap
 
@KamilSolecki That didn't make much sense. Maybe you meant: nou
 
Too hot to work.
 
@RoelvanUden sorry to ping you maybe you missed my message. senpai, oshiete kudasai
 
@Proxy I didn't see any problem with t
 
:( but i always get undefined when i try to call it
 
11:20 AM
@KamilSolecki ♪ tell me why ♫
 
@AvnerShahar-Kashtan I understand that struggle, women always fawning around you makes for a distracting workplace.
@Nerdintraining why ♫
 
@satibel ♪ I don't like mondays ♪
 
@KamilSolecki make a musically video upload it to youtube and post it here
 
@Nerdintraining the only thing that comes to my mind is the music from game montages
 
@satibel ♫ I'm too sexy for my job, too sexy for my job, so sexy it <rhyme for job> ♫
Seriously, though.
 
11:25 AM
We had that last week
This week it's perfect 22 deg
 
> Humidity 61%
Ugh.
Changed to a different weather monitoring station:
Feels like death.
 
@KamilSolecki and that dude is from... darn what was it callled again?^^
 
only 27 degree here.
and the week is like rain, cloudy, rain, rain, rain,rain,cloudy
 
@AvnerShahar-Kashtan ^^ i read the "feels like section" and then your comment. made me laugh :)
 
@Nerdintraining I'm glad my misery brings amusement to others. :)
 
11:35 AM
here it was around 35 last friday&thursday
 
last week it was like 40 degree feels like an oven
 
true
i went to a coffee around 10
i was in the shadow but still i melted
 
@AvnerShahar-Kashtan eilat 41
 
Hahahahaha you failed @hilli_micha
 
@KamilSolecki Dont embarass me on the internet, im sensitive.
 
11:43 AM
demonic laughter
 
Anyway, I'm still expecting a ping.
 
Alright. Back
 
You're not getting it.
 
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=46 time=16.5 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=46 time=15.3 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=46 time=15.5 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 15.359/15.820/16.599/0.563 ms
 
Awwww.
@SebastianL fascinating.
 
11:46 AM
So, could anyone recommend a good package/library for HTML-TO-PDF conversion?
 
@Xariez use the printfunction
 
Via what? The browser?
 
depends on your usecase
but that would work
 
So the mobile provider three has just lost its mobile internet
Which means i have no mobile internet
 
Well its a MVC application
 
11:47 AM
We used a library a couple of years ago that worked fine, though it was an unmanaged EXE that we spawned as a process.
 
@Xariez okay, that would be an arrow to the knee then :D
 
Because the "Save as PDF" option via any browser is not a option, unfortunately
 
@Xariez are you trying to implement reporting?
 
In this case, i can't say im 100% sure on what the definition of reporting is.
But, basically, we need to "extract" a form from a HTML page into a PDF
 
A report generator is a computer program whose purpose is to take data from a source such as a database, XML stream or a spreadsheet, and use it to produce a document in a format which satisfies a particular human readership. Report generation functionality is almost always present in database systems, where the source of the data is the database itself. It can also be argued that report generation is part of the purpose of a spreadsheet. Standalone report generators may work with multiple data sources and export reports to different document formats. Information systems theory specifies th...
 
11:50 AM
Well, I assume that would be it then, yeah
 
@Xariez and you use HTML for layouting?
or do you really want just the page as pdf
 
Yes. However, since we take both the layout AND form data from different databases, we can modify it quite freely
What we are making is some kind of agreement, if that helps?
So, layout wise, we would try to make this into this
Just as examples
So something thats primarily a form with some texts giving assistance, to a more "user friendly" or "eye friendly" version
 
@Xariez i don't have any experience with any library converting HTML to PDF, but it sounds more like a workaround. You should generate the PDF from the same source as you do for the HTML
it may be a bit more work, but it's worth the effort
you can use iTextSharp for that
 
Testing this PdfSharp method from Anestis
Might try the iTextSharp alternate afterwards depending on if this works or not
No idea where it saves it though, when you run "pdf.Save(ms);"
Oh nvm
 
12:16 PM
you can use pdfmake in your client
or pdfjs
thing is on server you have to actually pass the whole html to the pdf and its kind of iffy
for instance when I used itext I would just create tables from data received "manually"
 
Things are getting progressively worse.
 
Our A/C isn't up to the job.
 
That makes me happy
 
feels like 45
 
12:26 PM
I... I don't want to go out there. Please don't make me go outside. :(
 
D:
 
And i am sitting with long yeans here and in jacket because i am slightly cold
 
Oh jesus christ @AvnerShahar-Kashtan
Where at?
 
Forgive me, but isn't it mostly hot there?
 
12:27 PM
Yeah. We still complain about it every summer.
 
I mean, those temparatures are still waaay over my comfortable level
 
Still, this is hotter than average.
It's usually around 30 degrees here in the summer. 36 degrees is... excessive.
 
When we were visiting London we got around 29 and blessed every AC we found
 
@AvnerShahar-Kashtan If its more than 25 deg C, I feel uncomfortable.
 
^ If it's more than 20, I start feeling uncomfortable
 
12:29 PM
Luckily, since it's the standard, air conditioning is a standard in every car, every shop, almost every home.
 
If it goes past 25, i'd go seek the closest AC
 
I need AC at home asap
 
Buses technically have AC, but they're frequently out of order and can't always manage to hold back the heaving masses.
 
Alright, so using iTextSharp i think i have achieved HTML-To-XML conversion. However, trying to read my HTML file I receive the C# loops providing the data and whatnot. Is there a way to get the source from a page instead?
 
I honestly feel cold with my ac :^^^^^^)
 
12:42 PM
^ at least it's not >50 Celsius like in Arizona
 
His own fault if he did not park in the shade
 
I think it does not matter. If it's over 50...
and also. Why should we assume, that there is always enough space to park in a shade?
 
Bus stations in Tel Aviv were redesigned a few years ago to maximize space for ads. And, along the way, minimized the amount of shade they provide.
 
@ntohl deep in your heart you know if theres light, there will be always shadow
 
Hmm, this litle shit
 
When I'm attempting to read the data of a webpage that I need to use, I try to do it via HTTPWebRequests and HTTPWebResponses
However, the only way it will work is if i supply raw html data directly in a string. Otherwise it returns "Cannot access a closed stream"
 
Don't use HttpWebRequests. That's so 2003.
 
How else do i do it though, when basically every "guide" suggests it?
 
It's been superceded since .NET 2.0. Still useful if you need fine-grained control of all headers and such, but you can and should use HttpClient if you just need to get a page's content.
 
Aye
That I do
 
12:55 PM
good morning C#
 
Good day
 
var response = await new HttpClient().GetAsync("http://webpage");
var content = await response.Content.ReadAsStringAsync();
 
;)
and yes, what avner said
 
Lol i've just managed to kill visual studio^^
 
i need the police
 
12:56 PM
crash it because i wanted to stop debugging
 
or a third party library like restsharp or something
 
Or, if you're dead set on avoiding tasks and async/await, you can use .NET 2.0's WebClient: var content = new WebClient().DownloadString("http://website")
 
That one i already tried
Doesn't work, atleast not the way i tried it though
Just sits trying to run it, and fails
I should probably ask this from someone that can do better than guess:
Are you able to supply a localhost address? Or does it need to be a "actual" address?
 
Localhost should work. It's a URL.
 
Yeah
Assumed as much
But would have been awkward if that would have been the issue all along
 
12:58 PM
Wait, do you mean an http location on your machine, or a local filesystem path?
 
The localhost that VS creates
 
An ASP.NET site hosted on IISExpress, then.
 
Yeah
 
Yeah, should work. Assuming you're accessing the right port, of course.
What exception does it throw?
 
Using async it didn't even reach it, surprisingly
 
1:00 PM
@AvnerShahar-Kashtan you got by any chance a good tutorial on how to use await and async or can't i be lazy and have to look myself
 
And earlier when I tried the non-async version, it just sat there loading. Debugged it and it just sat poking the function but nothing happened.
 
@Nerdintraining Nothing specific.
 
Alright, let me try the non-asynchronous version one more time
Oh, actual error this time
 
By "non-async", you mean WebClient, right? You didn't use HttpClient.GetAsync().Result?
 
1:02 PM
@Nerdintraining seems you are on a good way, you await avner's async answere
 
That is indeed what I mean, yeah
 
H..uh
ERROR: The document has no pages.
Thats..interesting
 
is there a status code?
 
Not what I can see, no.
 
1:05 PM
I'm guessing it's a 200, with the error being on the server-side processing.
Because that doesn't look like an HTTP error message.
 
It seems like it's throwing on the part where i use iTextSharp though, rather than the WebClient part.
OH
Would maybe help to define the right variables
Not that it fixed it
But its a startr
Ah, now im back to a familiar error. "Cannot access a closed Stream" - Seems to be throwign on the MemoryStream
 
Why do you have a memorystream?
I think it's time to show us the actual code. :)
 
One sec
Fun fact before I send it over though, if i supply the content variable with raw html data, it works
 
how did the pdf look though
 
This far, as i would expect
It handled the HTML combined with CSS exactly as it was supposed to
 
1:09 PM
well bruno did a good job then
 
regarding git, do you guys push change after each bug fix or you wait until they accumulate? (i suppose you should commit after each change but just to ensure that i did it the wrong way)
 
@AvnerShahar-Kashtan best design choice ever made...
 
@Xariez I'm guessing doc.Close() closes the underlying stream/
Ah, wait, no, sorry.
Doc isn't backed by ms
writer is, though.
 
once you close doc write follows
 
1:15 PM
Their API is confusing. You're initializng a memorystream and a document, building a writer from them both, which is then never explicitly used.
Then you create an HtmlWorker from doc and presumably parse the html into the doc.
 
It is quite confusing, yeah
Yet I felt like it's the most "simple" solution, if one gets it to work
 
@Proxy no, commit only once you have completed the project. do not commit individual working steps.
 
XD
happy monday, lets all take a moment to be thankful that it's not friday
 
@satibel that's just mean.
 
@satibel well i did something similar now, thanks for confirming i did it the right way
 
1:17 PM
@satibel lol
 
(that was sarcastic, just in case.)
 
i know
 
I'd still say what confuses me the most though, @AvnerShahar-Kashtan
If I change the content of the html variable to, for example, @"<p>Sample text</p>", it runs it perfectly
 
sadly mine was not sarcastic
i'm not used to git so i just kept going with the fixes :/
 
And what does html contain when retrieved from the server?
 
1:19 PM
@Proxy commit message: misc bug fixes.
 
oh right
there error @Xariez
z
 
yeah i wrote add some stuff x,y and smaller bug fixes
 
it said no pages found
and it probably fell on save
 
It earlier said that
Because I had incorrectly defined some variables
 
did it fail on parse?
oh so no error now?
 
1:20 PM
I believe so, Yes
No, theres a error, but it says "Cannot access a closed Stream."
 
on ms.ToArray()?
 
Nope, on htmlWorker.Parse(sr);
 
I think that's doable, though, if it's like minor bugfixes that are in the same file, and might flood the history.
 
is stringreader empty?
What is it's length?
 
So what im guessing is happening is this:
1) It tries to fetch data from the URL, fails, and returns null (or an empty string)
2) It still tries to use this data, and because it has no data, it can't recognize any data either
3) It tries parsing an empty variable, and crashes
Why this variable is empty though..
 
1:23 PM
you mean why the request failed though..
right?
 
whats the status code on the request response
 
Well, that too
Alright, nevermind
 
eh?
 
The html variable is NOT null during the stage of crash.
 
Maybe ITextSharp is being stupid and crashing on a plaintext non-HTML string.
 
1:24 PM
Length of "sr" is 57001
 
what is the position of the sr stream?
I dont think thats the problem
but why not
 
Position is 0
 
> To summarize: you shouldn't use HTMLWorker. It won't be supported in the future.
5
Q: itextsharp HTMLWorker [deprecated]

U M A M A H E S HI have using itextsharp dll(v5.5.9.0) for generating a PDF from Html in Asp.net Mvc. In this, I am using a class HTMLWorker. I get a result that matches my requirement. It's working fine now. But it shows as [deprecated]. In the future, will it be working/supported or not? (or can I move to xmlwo...

 
40
Q: How to convert HTML to PDF using iTextSharp

Chris HaasI want to convert the below HTML to PDF using iTextSharp but don't know where to start: <style> .headline{font-size:200%} </style> <p> This <em>is </em> <span class="headline" style="text-decoration: underline;">some</span> <strong>sample<em> text</em></strong> <span style="color: red;">!!!

the second one does state a solution
@Xariez take the htmlagilitypack parse your html and take only the actual part of the html you want to PDF
 
I did look at that question earlier
However, i followed the first mentioned example, on the accepted answer
Probably the incorrect one
 
1:28 PM
@satibel these were scattered around though... well i just forgot about it :)
 
However, the other ones use iTextSharp.tool , which i cant seem to use
 
not the end of the world though.
 
yes
since you do say that your little snippet works
as long as your html isn't too complex
it should work
 
So i do it the same way
But parse it using Html Agility pack instead of HtmlWriter?
Or does HAP have its own Convert?
 
1:32 PM
no way
I am just saying cut down the html you have
and pass that to itext
 
Ah, okay
 
it doesn't compile?
it looks the same
 
Hold up, 1s
There you go
It does compile
But, I doubt im using HtmlAgilityPack correctly on lines 13 and 14
 
yes just dont toString()
 
Then it won't compile.
"Argument 1: cannot convert from 'HtmlAgilityPack.HtmlDocument' to 'string'"
 
1:39 PM
the load returns an HtmlDocument
on that HtmlDocument you need to do SelectSingleNode
in the select you can give it something like "body"
 
SelectSingleNode doesn't exist immediately.
 
So once i got this:
HtmlWeb hw = new HtmlWeb();
HtmlDocument hd = hw.Load(url);
HtmlNode node = hd.DocumentNode.SelectSingleNode("body");
 
node.OuterHtml
should give you the string
 
Well, it accepts it
Lets test it
Hmm
The document has no pages - again
 
1:46 PM
hmm you sure you passed only the body to the parser?
 
Pretty sure, yeah
If i put "html" in the SelectSingleNode, I'm back at the "Can't access a closed stream" error
 
both errors on the same line?
 
Good point, let me check that
Okay, not quite
If I select "html", it crashes at htmlWorker.Parse(sr)
If I select "body", it crashes at using (var sr = new StringReader(node.OuterHtml))
 
doesnt make sense
maybe cut it down further
 
Yeah, im quite lost
I might take a break from this for now, look at something else and come back to it tomorrow (or a completely different day)
But thanks a bunch for the help either way! Always amazing to see so many willing to help
 
2:23 PM
Huh funny
just found out that a Console.WriteLine() is freezing my application
 
@KendallFrey, I found something neat with Haskell
 
why am i not surprised
 
one more word about haskell and im locking the room
 
The method signature. You can specify if it is a pure or impure function
 
@Nathvi All functions in Haskell are pure. Are you talking about IO?
 
2:25 PM
and if you have impure code calls inside of a pure function, it is a compiler function
yes
 
a "compiler function"?
 
lol, sorry, I haven't had my coffee yet
if you attempt to call IO code in a function that doesn't explicitly have that declared, it will break the function
 
main = newCoffee >>= Nathvi
@Nathvi The way you're describing that is completely different than how I understand it
 
It's probably wrong then
 
What do you mean by "call IO code"?
There's no way to "call" IO
only the compiler/runtime can do that
Maybe it would make it clearer to realize that IO is basically identical to Task in C#. It's just another kind of value, representing an action.
 
2:31 PM
ahh
 
oh, did you start learning Husky, @Nathvi?
 
just a small town girl
living in a lonely world
took the midnight train
 
and got groped by a stranger
 
well, that escalated quickly
 
2:33 PM
but probably more accurate than the actual song
 
♪ Don't stop believing ♫
 
@RoelvanUden The Pope, much like Kim Jong Il, does not defecate
 
I'm wondering something @KendallFrey in haskell, how can a function write to disk if it isn't allowed to have side effects?
 
@satibel By returning an IO that represents the side effect of writing to disk
 
2:49 PM
I FOUND THE BUG
TIME TO GO HOME and fix it tomorrow
 
 

« first day (2445 days earlier)      last day (2520 days later) »