Quantcast
Channel: HtmlRenderer Discussions Rss Feed
Viewing all 63 articles
Browse latest View live

New Post: WinRT-Support in future?

$
0
0
Hi,

I'm actually looking for an HTML-Renderer for WinRT. I tried the "HTML Renderer"-Demo and it looks super with my samples.

Is there a plan to support WinRT in the future? Because I don't see a good HTML-Renderer out there for WinRT and this library works well in native WPF. So I think it should work in WinRT too or am I wrong?

Regards,
Alex

New Post: Increase render resolution for HtmlRender.RenderToImage

$
0
0
I used a graphics object, and then set graphics.ScaleTransform( XRes/SCREENRES, YRes/SCREENRES ) before the RenderGdiPlus call. Image was scaled up and looked nice, not magnified. Only issue was HtmlRender returns unscaled height, so you need to scale that up by the y factor. Other than that your library looks great so far!

New Post: Generate image with background problem

$
0
0
nbrege wrote:
I sort of got it to work. The background image is showing behind the rendered HTML, but it doesn't fill the entire background. It only fills a small portion of the upper-left area. The rest is just black. What am I doing wrong?
@nbreg does your issue fixed? I am having same issue where my image is scaled to small size and html rendered on it but remaining area is just black.

@ArthurTep or @nbregv
Can you please give me a hint to sort-out the issue?

Thanks

New Post: Code to handle image data URIs

$
0
0
Could it be possible to use a base64 uri as a background image also ?

New Post: Render to Image with Transparent Backgroun

$
0
0
is it possible to render the image with a transparent background? I have tried to modify the alpha on the background but can not seem to get it to be transparent without creating a hacky process of setting the background to a color and then removing the color

New Post: How to load PNG as `byte[]` to HtmlImageLoadEventArgs callback?

$
0
0
I have a PNG from a database as byte[]. How can I set as a HTML image? I use this for PDF creation and the wiki/documentation is sadly lacking...
        public void HandleImageLoad(object sender, HtmlImageLoadEventArgs args)
        {
              var img = LoadFromSource();
                if(img == null)
                {
                    args.Handled = false;
                    args.Callback();
                    Log.Error("Missing image: {0}", args.Src);
                }
                else
                {
                    args.Handled = true;
                    args.Callback(img.Data);
                }                                       
        }

New Post: How to generate PDF with footer and page numbers?

$
0
0
TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdfonly takes a HTML document and lets me set page size and margins. How can I also set a page footer or page numbers from HTML?

New Post: How to load PNG as `byte[]` to HtmlImageLoadEventArgs callback?

$
0
0
For future reference:
The trick is to create a GDI image from a MemoryStream of the PNG picture. That can then be used to create a XImage as callback parameter.
using(var mem = new MemoryStream(img.Data))
{
    System.Drawing.Image sysImg = System.Drawing.Image.FromStream(mem, false, true);
    XImage ximg = XImage.FromGdiPlusImage(sysImg);
    args.Callback(ximg);
}

New Post: TAG HTML inside the is not drawn.

$
0
0
<table>
    <tr>
        <td>
            <span>Text</span>
        </td>
    </tr>
</table>
When I use HTML tag inside the <TD>, TAG is not drawn.

I commented on CSS Default the following line "td, th {border-color: #dfdfdf; overflow: hidden;}" and got success.

Thank you.

New Post: How to have custom controls "with-in" the web page?

$
0
0
Is it possible to have winform controls "embedded" within the pages?

Thanks,
Kris

New Post: fonts that aren't installed on system

$
0
0
Hi TheRhinoDude,

Would this solution to add custom fonts work to render as a PDF?

Thanks

New Post: Generate PDF with custom Fonts

$
0
0
Hi,

I am really interested in using HTML Renderer to produce PDF files out of my html reports.

After searching through the code and exemples, I couldn't find any code sample that shows how could I generate an pdf from a html file that uses custom fonts.

I use barcode fonts on my reports and really need it to get exported.

Could anyone guide me in the right direction?

Thanks

New Post: Barcode Not rendering when use RenderToImage

$
0
0
Hi

I am converting an html with a barcode to an bitmap image. The text comes out fine but the barcode does not appear. Any suggestions?

New Post: HtmlRender.RenderToImage crashing

$
0
0
I'm trying to integrate HtmlRenderer with an existing project. I have references to HtmlRenderer and to HtmlRenderer.WinForms. Right now I am producing some very simple HTML, for example:

sHtml = "<P>ComputerName</P><P>10.4.59.34</P>";

or slightly more complex, with html and body tags included:

sHtml = "<html><body><P align=right><FONT color=#ff8040 size=5 face=Arial><STRONG>DESKPC</STRONG></FONT></P>\r\n<P align=right><FONT size=2 face=Arial>10.58.4.13<br />10.99.87.1</FONT></P>\r\n<P align=right><FONT size=2 face=Arial>DOMAIN\Usernasme</FONT></P></body></html>"

I also generate a background Bitmap on which I wish to render the HTML, this is produced using managed code (Graphics object) with various calls:

Bitmap B = new Bitmap (1024,768);
...
...

When running in VS.Net, and I attempt to render the text to the Bitmap, I get a crash - specifically, "vshost32-clr2.exe has stopped working". Here's the (sole) call into HtmlRenderer, which looks to me to be exactly like the documented example:

HtmlRender.RenderToImage(B, sHtml, new Point(400, 200));

If I run the code outside of VS.Net, it doesn't seem to work, but it doesn't crash either. I'm a bit lost as to how to proceed!

One other observation:
If I save the file to disk then load it straight back into an Image, no crash, but no rendered output is found:

B.Save("D:\D1.PNG");
Image I = Image.FromFile("D:\D1.PNG");
HtmlRender.RenderToImage(I, sHtml, new Point(400, 200));

New Post: How to have custom controls "with-in" the web page?

$
0
0
I ended up doing this by exposing the DOM to get the cords of the element I wanted to put it in and doing it after the control was painted...

Don't understand why the DOM not exposed?

Kris

New Post: Multiple pages from HTML

$
0
0
I have a number of seperate HTML pages that I would like to convert to one single PDF Document. How can I do that?

At the moment I'm creating a seperate PDF for every page, save it to MemoryStream, open it again with PdfSharp PdfDocumentOpenMode.Import and add the pages to the "main" document.
var pdf = new PdfSharp.Pdf.PdfDocument();
// .. snip

                        foreach (var s in sheets)
                        {
                            // ... snip - sheetContent is the page HTML

                            if (!string.IsNullOrEmpty(sheetContent))
                            {
                                var pagePDF = TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(sheetContent, PdfSharp.PageSize.A4);
                                using (var pageStream = new MemoryStream())
                                {
                                    pagePDF.Save(pageStream, false);
                                    pageStream.Position = 0;

                                    var importPagePDF = PdfSharp.Pdf.IO.PdfReader.Open(pageStream, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import);

                                    pdf.AddPage(importPagePDF.Pages[0]);

                                    importPagePDF.Close();
                                    pagePDF.Close();
                                }
                            }
                        }

New Post: Azure Websites

$
0
0
Hey guys,
I'm getting the same problem whereby our images are showing up black after we migrated a custom site across to Azure.

I've noticed that the code is using the GDI and we are on a Standard plan.

Are you able to advise how you used the RenderToImageGdiPlus our code is using HtmlRender.RenderToImage to get an image object and then trying to save that to the uploads directory. I can't see anyway to make it use the RenderToImageGdiPlus.

System.Drawing.Image image = HtmlRender.RenderToImage(sbHtml.ToString(), new Size(250, playlists.Count * 150), PlaylistRendererHelper.BackgroundColor);
image.Save(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["PlaylistImages"]) + uniquePlaylistId + ".png", ImageFormat.Png);

We use this to create a facebook og image on the fly to share selected playlist images in a site.

New Post: 2 columns

$
0
0
Hi,
Is there a way to get 2 fixed width columns side by side?

I've tried float left and right and inline-block but they are not implemented. I've tried a table but the widths of the cells are ignored.

New Post: 2 columns

$
0
0
I've tried again and succeeded with a table.

New Post: PdfGenerator.GeneratePdf don't work

$
0
0
Good afternoon, I will discuss my situation ...

I use HtmlRenderer and PDFsharp to generate pdf from my application. Specifically use versions:
HtmlRenderer v1.5.0.6
PDFsharp v.1.50.3638.0

My problem is that in trying to generate the pdf document with the method:
PdfDocument pdf = PdfGenerator.GeneratePdf (htmlCode, PageSize.Letter); the error occurs:

An exception occurred in the type initializer 'TheArtOfDev.HtmlRenderer.PdfSharp.Adapters.GraphicsAdapter'.

The strange thing is that with previous versions of HtmlRenderer v.1.5.0.5 and PDFsharp v. 1.32.3057.0 worked perfectly.

My code is:
public byte[] GenerarPDFfromHTML(string htmlCode)
    {
        MemoryStream msBody = new MemoryStream();
        PdfDocument pdf = PdfGenerator.GeneratePdf(htmlCode, PageSize.Letter);
        pdf.Save(msBody, false);
        return msCuerpo.ToArray();
    }
I will appreciate your help.
Viewing all 63 articles
Browse latest View live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>