Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to get 2 parametrs from windows phone 8 to php index file , with get or post method
any solutions?
WebClient webClient = new WebClient();
webClient.DownloadStringCompleted += (s, e) =>
{
};
webClient.DownloadStringAsync(new Uri(String.Format("http://example.com?par1={0}&par2={1}", "param1", "param2"), UriKind.RelativeOrAbsolute));
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 months ago.
Improve this question
I've got an API where I accept a stream representing an image (usually about ~3mb) and I write this stream into a file. When I test this locally with postman, writing the stream into the file takes about ~20ms. However, when deploying this to production this process takes around 1000ms.
Guid guid = Guid.NewGuid();
string input = InputPathWithExtension(guid);
string output = OutputPathWithExtension(guid);
using FileStream file = File.OpenWrite(input);
await stream.CopyToAsync(file);
await stream.DisposeAsync();
await file.DisposeAsync();
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is there a way to convert a PDF page to bitmap in c#? I tried with Ghostscript but I think it is file based. Thanks in advance.
LibPdf
This library converts converts PDF file to an image. Supported image formats are PNG and BMP, but you can easily add more.
using (FileStream file = File.OpenRead(#"..\path\to\pdf\file.pdf")) // in file
{
var bytes = new byte[file.Length];
file.Read(bytes, 0, bytes.Length);
using (var pdf = new LibPdf(bytes))
{
byte[] pngBytes = pdf.GetImage(0,ImageType.BMP); // image type
using (var outFile = File.Create(#"..\path\to\pdf\file.bmp")) // out file
{
outFile.Write(pngBytes, 0, pngBytes.Length);
}
}
}
Read this article: PDF to bmp Images (12 pages = 12 images)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'd like to download the daily photo from this site but i can't use the JPEG's URL because it changes everyday.
Is there any way to download object from site using the page URL and XPath? I tried to find some method in WebClient but with no luck.
An example of my comment with HTML Agility Pack :
WebClient client = new WebClient();
string resource = client.DownloadString("http://photography.nationalgeographic.com/photography/photo-of-the-day/");
HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument();
html.LoadHtml(resource);
var imgDiv = html.DocumentNode.SelectSingleNode("//*[contains(#class,'primary_photo')]");
var imgSrc = imgDiv.SelectSingleNode("//img/#src");
string relativePath = imgSrc.GetAttributeValue("src", "");
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to Convert a MVC 4 View to a PDF. I have no idea where to start, after searching google i found ItextSharp and have been playing around with it.
My View is fairly Simple it has a Map and a Table. i would like to just call an action in the controller and have it print my web page.
Any Advice would be greatly Appreciated
You can use Rotativa
public ActionResult TestViewWithModel(string id)
{
var model = new TestViewModel {DocTitle = id, DocContent = "This is a test"};
return new ViewAsPdf(model);
}
public ActionResult PrintIndex()
{
return new ActionAsPdf("Index", new { name = "Giorgio" }) { FileName = "Test.pdf" };
}
It uses wkhtmltopdf under the hood.
wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line
tools to render HTML into PDF and various image formats using the QT
Webkit rendering engine. These run entirely "headless" and do not
require a display or display service.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I got success to post photos to Twitter. But how do i post videos to Twitter using my C# application?. For posting pictures i used Tweetsharp. Can we use Tweetsharp's SendTweetWithMediaOptions to share video? if yes How?
This is sample i used to share picture to twitter
Bitmap img = new Bitmap(Server.MapPath(#"~/Images/Special/" + Convert.ToInt32(offerId) + "/" + specialOffer.Picture));
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Seek(0, SeekOrigin.Begin);
Dictionary<string, Stream> images = new Dictionary<string, Stream> { { "mypicture", ms } };
var tweet = tweetservice.SendTweetWithMedia(new SendTweetWithMediaOptions { Status = urlTextToShare, Images = images });
and what i need is something like below image
You cannot upload videos to Twitter. If you read their documentation, it says:
Supported image formats are PNG, JPG and GIF, including animated GIFs of up to 3MB
You choices are either to upload an animated GIF or include a URL to a video (such as YouTube / Vimeo)