Using css2pdf to generate pdf documents from html - angularjs

This is a followup post from another stackoverflow question that this site would not let me paste (Apologies for not extending that other post)
Based on Kevin Brown's suggestion, I experimented a bit with css2pdf and I ran into a few issues - here is the modified plunkr
http://plnkr.co/edit/xBO4DjcOlrmH82bAqyR1?p=preview
app.service('PdfGenService', function(){
this.generatePdf = function(jQueryElement) {
jQueryElement.show();
function generate(){
xepOnline.Formatter.Format("toGenerate",{render:'download'});
}
setTimeout(generate, 1000);
};
});
#Kevin (If you see this post),
My questions are as follows
What am I doing wrong with - The downloaded pdf does not have any of my charts (it has other content correctly rendered)
I cannot click on the contact for cloudformatter.com for me to ask them how to get a commercial use license since we cannot go outside our domain for security reasons. How do I reach out to them? Could you give me some more pointers on RenderX or any other engine that does similar things?
Thank you

Related

How to manipulate 2sxc/dnn search result titles?

Does anybody have any idea on how to manipulate 2sxc/dnn search result titles?
Something like si.Title ?
Becuase at the moment search results are showing the page title and not the post title.
si.QueryString = "details=" + article.UrlKey;
si.Title = article.Title;
I tried the above code but it does not work.
2sxc doc: https://docs.2sxc.org/api/dot-net/ToSic.Sxc.Search.ISearchItem.html
Hi #BondLookingForAnswers - welcome to StackOverflow :)
I'm not sure if DNN will prefer your title to the page title, but either way I suggest you check out the latest blog app (https://2sxc.org/en/apps/app/blog-app-v4), which customizes the search results, and see where that gets you.
Good luck!

Gmail API - Watch not sending filtered notifications

I have seen a couple of posts in StackOverflow related to this question but still they don't give me a concrete answer. So, posting a new question here.
I am trying to setup a watch on INBOX and SENT labels. Here is the code snippet I use
WatchRequest watchReq = new WatchRequest();
watchReq.setTopicName("mytopicgoeshere");
List<String> labelIds = Arrays.asList("INBOX", "SENT");
watchReq.setLabelIds(labelIds);
watchReq.setLabelFilterAction("include");
WatchResponse response = gmailService.users().watch(CURRENT_USER, watchReq).execute();
Though I specify the label ids and filter action correctly, I am still getting notification for all events not just for the labels I specified. Any idea how to get this working correctly? Any idea if it is a Google issue and fixed by them?
This is actually a bug with the GMail API. There is an entry for it on Google's Issue Tracker as linked below. Please star the issue to draw more attention to it:
https://issuetracker.google.com/issues/36759803

templatetags and context['request']

So i'm learning Wagtail and trying to understand how to generate menus. So far i've found the bakerydemo repo helpful. One major point of confusion for me is understanding how to use the templatetags used for menus in the bakery demo. Below is the code for the get_site_root tag (django docs recommend that as of 1.11 that simple_tag will also work and so I changed it to that.)
#register.assignment_tag(takes_context=True)
def get_site_root(context):
# This returns a core.Page. The main menu needs to have
# the site.root_page
#defined else will return an object attribute error ('str' object
#has no attribute 'get_children')
return context['request'].site.root_page
No matter what I do I can't seem to get this to work. Either nothing is returned or I get various errors like the request key isn't in context or others. I looked at the Site middleware then traced that to the site model staticmethod "find_for_request" which in turn should be calling "get_site_for_hostname" in the sites.py . Anyways, I would love some guidance on what I am doing wrong or misunderstanding. Also, any help in understading the "wagtailthonic" way of generating menus from page hierarchies would be welcome.
Here is an image of the page and site tables.

Getting $http.put() to send correctly formatted data, instead of JSON object

So, I spent some time and built a quick API for a project that I'm doing for myself.
I used the Postman add-on for Chrome to mimic PUT and DELETE quests to make sure everything worked correctly. Really happy I did that, as I learned a lot about PHP's shortcomings with PUT and DELETE requests.
Using the API I've had working with Postman, I started moving everything over to AngularJs controllers and such.
I'm trying to get a user to claim a row in a database as the login information for the users is different than this particular information. I couldn't figure out why the put requests to claim the row in my database wasn't working. Lo and behold, the data being parsed from my parsestr(file_get_contents('php://input')) had 1 array key, which was a JSON string.
I've looked, and I can't seem to find a solid answer either through Stackoverflow or Google (maybe I missed it somewhere in the config options), So my question is this: is there any way I can get the $http.put call send the data to the server correctly?
Thanks to user Chandermani for pointing me to the link at this URL which answered the base of my question.
From the above link, I found myself on This Blog post submitted by another user. In the end, what I ended up doing was the following:
taking param() function from the above link, as well as implementing these lines of code:
var app = angular.module('ucpData', [] , function($httpProvider){
$httpProvider.defaults.transformRequest = [function(data) {
return angular.isObject(data) && String(data) !== '[object File]' ? param(data) : data;
}];
});
Is how I worked around the problem. For some developers, you may actually want to keep the default transformRequest settings, but for the project I am doing I know that I will end up forgetting to call param() at some point, and my server doesn't naturally accept json data anyway. I would caution future developers to consider what they are attempting to do before they alter the transformRequest array directly.

disabling prettyPhoto on mobile

I may be too much of a noob to be asking here, but I've gotten a lot of help with other issues by searching here and finding others Q&A's, so am going to try my own.
The short version of what I'm looking for is a way to disable prettyPhoto on small mobile screens (phones, not tablets) - or maybe even better to just disable the caption ("title" text) when on phones only.
Originally, I wasn't able to get prettyPhoto to open when viewed on the phone. I fixed that with this solution: (I'm not allowed to post the link since this is my first post - but the bitly address is 10tsboq)
But now the caption ("title" text in the code) forms a long vertical string as shown here: http://grab.by/j9f0
I did find this solution posted to disable prettyPhoto altogether on phones using Modernizr, http://forums.no-margin-for-errors.com/discussion/5282/pretty-photo-on-a-mobile-device-iphone#Item_7 but either I'm not understanding where to put the code or I've just done it wrong. Anyone know where that code should go? (just tacked on at the bottom of the prettyPhoto js or css? Or replacing something existing in the code? Or somewhere else altogether?
Or - any other completely different suggestions to solve the issue?
(by the way, I'm working on a Squarespace v6 platform for the site, in case that matters)
Thanks!
for anyone looking for the answer to this, I tracked down a commenter on the original post and they were super cool about being willing to answer a strangers email to offer explanation - so, to answer the question I had posed on the modernizr script - it goes into the prettyPhoto code that is most likely in your footer:
(something like this):
<script type="text/javascript" charset="utf-8">
  $(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
INSERT MODERNIZR MQ CODE HERE
  });
</script>
hope that helps someone!

Resources