{"id":16672821,"url":"https://github.com/brcontainer/html2canvas-csharp-proxy","last_synced_at":"2026-03-17T07:41:01.151Z","repository":{"id":9815608,"uuid":"11798650","full_name":"brcontainer/html2canvas-csharp-proxy","owner":"brcontainer","description":"C# Proxy html2canvas (aspx)","archived":false,"fork":false,"pushed_at":"2014-09-29T02:35:43.000Z","size":290,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T21:51:57.558Z","etag":null,"topics":["asp-net","csharp","html2canvas","html2canvas-proxy","proxy-server"],"latest_commit_sha":null,"homepage":"","language":"ASP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brcontainer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-31T18:58:28.000Z","updated_at":"2023-01-03T06:56:56.000Z","dependencies_parsed_at":"2022-09-05T07:01:37.121Z","dependency_job_id":null,"html_url":"https://github.com/brcontainer/html2canvas-csharp-proxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brcontainer%2Fhtml2canvas-csharp-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brcontainer%2Fhtml2canvas-csharp-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brcontainer%2Fhtml2canvas-csharp-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brcontainer%2Fhtml2canvas-csharp-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brcontainer","download_url":"https://codeload.github.com/brcontainer/html2canvas-csharp-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103915,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","csharp","html2canvas","html2canvas-proxy","proxy-server"],"created_at":"2024-10-12T12:07:26.244Z","updated_at":"2026-03-17T07:40:56.130Z","avatar_url":"https://github.com/brcontainer.png","language":"ASP","funding_links":[],"categories":[],"sub_categories":[],"readme":"html2canvas-proxy-csharp 0.0.6\n=====================\n\n#### C# Proxy html2canvas ####\n\nThis script allows you to use **html2canvas.js** with different servers, ports and protocols (http, https),\npreventing to occur \"tainted\" when exporting the `\u003ccanvas\u003e` for image.\n\n### Others scripting language ###\n\nYou do not use ASP.NET, but need html2canvas working with proxy, see other proxies:\n\n* [html2canvas proxy in php](https://github.com/brcontainer/html2canvas-php-proxy)\n* [html2canvas proxy in asp classic (vbscript)](https://github.com/brcontainer/html2canvas-asp-vbscript-proxy)\n* [html2canvas proxy in python (work any framework)](https://github.com/brcontainer/html2canvas-proxy-python)\n\n###Problem and Solution###\nWhen adding an image that belongs to another domain in `\u003ccanvas\u003e` and after that try to export the canvas\nfor a new image, a security error occurs (actually occurs is a security lock), which can return the error:\n\n\u003e SecurityError: DOM Exception 18\n\u003e\n\u003e Error: An attempt was made to break through the security policy of the user agent.\n\n### Follow ###\n\nI ask you to follow me or \"star\" my repository to track updates\n\n### Usage ###\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"utf-8\"\u003e\n        \u003ctitle\u003ehtml2canvas ashx (c#) proxy\u003c/title\u003e\n        \u003cscript src=\"html2canvas.js\"\u003e\u003c/script\u003e\n\t\t\u003cscript\u003e\n\t\t//\u003c![CDATA[\n\t\t(function() {\n\t\t\twindow.onload = function() {\n\t\t\t\thtml2canvas(document.body, {\n\t\t\t\t\t\"logging\": true, //Enable log (use Web Console for get Errors and Warings)\n\t\t\t\t\t\"proxy\":\"html2canvasproxy.ashx\",\n\t\t\t\t\t\"onrendered\": function(canvas) {\n\t\t\t                        var img = new Image();\n\t\t\t                        img.onload = function() {\n\t\t\t                            document.body.appendChild(img);\n\t\t\t                        };\n\t\t\t                        img.error = function() {\n\t\t\t                            if(window.console.log) {\n\t\t\t                                window.console.log(\"Not loaded image from canvas.toDataURL\");\n\t\t\t                            } else {\n\t\t\t                                alert(\"Not loaded image from canvas.toDataURL\");\n\t\t\t                            }\n\t\t\t                        };\n\t\t\t                        img.src = canvas.toDataURL(\"image/png\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t})();\n\t\t//]]\u003e\n\t\t\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cp\u003e\n            \u003cimg alt=\"google maps static\" src=\"http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672\u0026amp;zoom=12\u0026amp;size=400x400\u0026amp;maptype=roadmap\u0026amp;sensor=false\"\u003e\n        \u003c/p\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n\n#### Using Web Console ####\n\nIf you have any problems with the script recommend to analyze the log using the Web Console from your browser:\n* Firefox: https://developer.mozilla.org/en-US/docs/Tools/Browser_Console\n* Chrome: https://developers.google.com/chrome-developer-tools/docs/console\n* InternetExplorer: http://msdn.microsoft.com/en-us/library/gg589530%28v=vs.85%29.aspx\n\nGet NetWork results:\n* Firefox: https://hacks.mozilla.org/2013/05/firefox-developer-tool-features-for-firefox-23/\n* Chrome: https://developers.google.com/chrome-developer-tools/docs/network\n* InternetExplorer: http://msdn.microsoft.com/en-us/library/gg130952%28v=vs.85%29.aspx\n\nAn alternative is to diagnose problems accessing the link directly:\n\n`http://[DOMAIN]/[PATH]/html2canvasproxy.php?url=http%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D40.714728%2C-73.998672%26zoom%3D12%26size%3D800x600%26maptype%3Droadmap%26sensor%3Dfalse%261\u0026callback=html2canvas_0`\n\nReplace `[DOMAIN]` by your domain (eg. 127.0.0.1) and replace `[PATH]` by your project folder (eg. project-1/test), something like:\n\n`http://localhost/project-1/test/html2canvasproxy.php?url=http%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fstaticmap%3Fcenter%3D40.714728%2C-73.998672%26zoom%3D12%26size%3D800x600%26maptype%3Droadmap%26sensor%3Dfalse%261\u0026callback=html2canvas_0`\n\n### .NET Framework compatibility ###\nFrom version 0.0.4 has become the code compatible with older versions of the .net framework, being compatible with version .net framework 2.0+\n\n### Alternatives for C#(C Sharp) ###\nYou are not using html2canvas but need a similar solution?\nSee **simpleHttpProxy**:\n\n*c#* https://github.com/brcontainer/simple-http-proxy-csharp\n\n### Changlog ###\n\n#### html2canvas-csharp-proxy 0.0.5 and 0.0.6 ####\n\n * Added support to HTTP Basic access authentication \n * Added support to use data URI scheme in callback\n * Added support to SVG images\n * Added support to requests/response without \"Content-Length\"\n * Added detection if the \"Content-Length\" header is equal to \"0\" (Content-Length: 0)\n * Moved \"setup vars\" to \"Class\"\n * Removed unecessary \"fullurl = fullurl\"\n * Removed \"must-revalidate\" header\n * Remove charset in \"mimetype\"\n * Fixed bug in detecting if \"callback\" and \"url\" are undefined (GET params)\n * Fixed Ascii2Inline function (version 0.0.6)\n * Fixed size in buffer (sometimes had negative number and the buffer causing an error in the script) (version 0.0.6)\n * Replace \"tabs\" by space (4 size) (version 0.0.6)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrcontainer%2Fhtml2canvas-csharp-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrcontainer%2Fhtml2canvas-csharp-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrcontainer%2Fhtml2canvas-csharp-proxy/lists"}