I am using TuesPechkIn to convert my html to PDF. I am setting the configuration as follows:
My question is, can I remove the top margin from the first page of the PDF only? (Basically its the cover page which includes a banner image). Is there any way to implement this.
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
DocumentTitle = "My Report",
PaperSize = PaperKind.A4,
Margins =
{
Top = 1.25, //Need to make it as 0 for the first page
Left = 0.00,
Right = 0.00,
Bottom = 1.25,
Unit = TuesPechkin.Unit.Centimeters
},
PageOffset = 2
},
Objects =
{
new ObjectSettings
{
HtmlText = htmlText,
FooterSettings = footerSettings
}
}
};
return converter.Convert(document);
A work around would be to remove that image in JavaScript. I was having the same issue on an element in the last bottom page an basically what I did was:
var element = document.getElementById("someID");
element.parentNode.removeChild(element);
put that code when the window loads and add it to your htmlText, it will remove the element for you before it generates the PDF.
To do this you need to enable js by simply adding to your Objects :
WebSettings =
{
EnableJavascript = true
}
Hope it helps you :)
Related
I have been bashing my head against the wall for 8 hours now, trying to figure out how to add thumbnails to embeded messages. I've been following this tutorial that uses ThumbnailURL, something that doesn't exist in the context he's using it for. Instead I just have Thumbnail which does not take a string, but rather an EmbedThumbnail which I can't access at all.
var avatarEmbed = new DiscordEmbedBuilder
{
Title = "Enter the game.",
Thumbnail = ctx.Client.CurrentUser.AvatarUrl,
Color = DiscordColor.Azure,
};
Please don't send links to docs and tutorials. I've tried. I've really tried. But this just seems like an issue that is very recent and therefore resources on it would be next to none. Also the docs don't seem to have example code, making it all more frustrating.
Not sure about your version but I use the latest nightly build.
and I do it like this
var builder = new DiscordEmbedBuilder
{
Title = "Title Here",
Color = DiscordColor.Azure
};
builder.WithThumbnail(ctx.Client.CurrentUser.AvatarUrl);
but you can also do it this way
var builder = new DiscordEmbedBuilder
{
Title = "Title Here",
Color = DiscordColor.Azure,
Thumbnail = new DiscordEmbedBuilder.EmbedThumbnail
{
Url = ctx.Client.CurrentUser.AvatarUrl
}
};
I'm having trouble getting ligatures to show up in DirectWrite code. I'm using a ligature-rich font and am basically applying every ligature tag I can get my hands on:
var typography = new Typography(dwriteFactory);
var ligatureTags = new[]
{
FontFeatureTag.StandardLigatures,
FontFeatureTag.StylisticAlternates,
FontFeatureTag.DiscretionaryLigatures,
FontFeatureTag.RequiredLigatures,
FontFeatureTag.ContextualLigatures,
FontFeatureTag.HistoricalLigatures
};
foreach (var tag in ligatureTags)
{
FontFeature ff;
ff.NameTag = tag;
ff.Parameter = DisableLigatures ? 0 : 1;
typography.AddFontFeature(ff);
}
textLayout.SetTypography(typography, EntireRange(text));
From the above code, StylisticAlternates and DiscretionaryLigatures work. But, whatever I do, StandardLigatures do not work.
Can anyone give suggestions as to why this wouldn't be working?
I have the following code to add title tab to the DocuSign document - not a template - in C#.
It has worked up until now, but today the tab on the document comes up vertically, so all characters in the title show up vertically.
I am only seeing this when I go to correct the document on DocuSign web site. It does not show that way when I receive for signature. I was not correcting anything, but just checking to ensure that everything was as expected.
Instead of
Manager
it comes up as
M
a
n
a
g
e
r
How can I fix that? The code is below.
tab13.PageNumber = "17";
tab13.DocumentID = docId;
tab13.Type = DocuSignAPI.TabTypeCode.Custom;
tab13.CustomTabType = DocuSignAPI.CustomTabType.Text;
tab13.Name = "txtTitle";
tab13.Value = mgrTitle;
tab13.CustomTabTypeSpecified = true;
tab13.AnchorTabItem = new DocuSignAPI.AnchorTab();
tab13.AnchorTabItem.AnchorTabString = "Title:";
tab13.AnchorTabItem.Unit = DocuSignAPI.UnitTypeCode.Pixels;
tab13.AnchorTabItem.UnitSpecified = false;
tab13.AnchorTabItem.IgnoreIfNotPresent = true;
tab13.AnchorTabItem.UnitSpecified = true;
tab13.AnchorTabItem.YOffset = -20;
tab13.AnchorTabItem.XOffset = 50;
I am only seeing this when I go to correct the document on DocuSign web site. It does not show that way when I receive for signature. I was not correcting anything, but just checking to ensure that everything was as expected.
I'm using Xamarin and Monotouch.Dialog to show some text comments in a UIPopoverControl. If the text being shown in a StyledMultilineElement is of any great length then the Caption and the text is being shown further down (see image below). This problem gets worse if your text string is really big, say about 20,000 characters, because you get a huge scrolling cell with no text in it at all. Simplified version of the code I'm using in my UITapGestureRecognizer below.
Am I doing something wrong?
Is there a workaround?
I did have a look at the source of the StyledMultilineElement here and am not sure if the issue is with UITableView.StringSize method.
Any known issues with UITableView.StringSize?
Thanks,
Gavin
Sample code:
RootElement root = new RootElement("Title") { UnevenRows = true };
var section = new Section("Section Heading");
// Get a value string that is approx 1,000 chars long
var value = GetLongString();
var element = new StyledMultilineElement("Caption", value, UITableViewCellStyle.Subtitle)
{
LineBreakMode = UILineBreakMode.WordWrap,
Font = UIFont.FromName("HelveticaNeue", 16f),
SubtitleFont = UIFont.FromName("HelveticaNeue", 16f)
};
section.Add(element);
root.Add(new List<Section>() { section });
var viewController = new DialogViewController(root);
var navbarController = new UINavigationController(viewController);
_contactPopup = new UIPopoverController(navbarController);
_contactPopup.PresentFromRect(cell.Bounds, cell, UIPopoverArrowDirection.Any, true);
Edit:
Found the issues page on git hub and added issue there too Git Hub Issue #225
How to Insert Time line card using In C#.Net Mirror API, which has bundle inside bundle?
In below code what I am doing is create a single bundle.
What I want is item1 and item2 to be different bundles. Is is possible?
Is there a solution?
TimelineItem item = new TimelineItem()
{
Text = controller.Request.Form.Get("message"),
BundleId = "112",
IsBundleCover=true,
Notification = new NotificationConfig() { Level = "DEFAULT" }
};
TimelineItem item1 = new TimelineItem()
{
Text = "Amalan",
BundleId = "112",
Notification = new NotificationConfig() { Level = "DEFAULT" }
};
TimelineItem item2 = new TimelineItem()
{
Text = "Sanath",
BundleId = "112",
Notification = new NotificationConfig() { Level = "DEFAULT" }
};
Nested bundles aren't currently supported in the Mirror API, there's an issue you can star to get updates on the progress in this area: https://code.google.com/p/google-glass-api/issues/detail?id=167
Depending on your use case, you can also try to work around this by using HTML cards with paging for the inside bundles, but this will only work if the cards in the bundle all have the same Menu Items.
So instead of creating a bundle of several cards you would create one card where you put all the contents of all cards as HTML, and then either let it auto-paginate or explicitely define the content of the separate cards. See https://developers.google.com/glass/timeline#paginating for details and examples.
You can then add each of these paginated HTML cards to your bundle.