4
Contributors
13
Replies
26
Views
5 Years
Discussion Span
Last Post by SautinSoft
Featured Replies
  • 2
    __avd 1,826   5 Years Ago

    *ABCpdf* is commecial product. Use **wkhtmltopdf** tool or download the iTextSharp library. ([Tutorials link)](http://www.aspsnippets.com/Articles/Export-ASPNet-Web-Page-with-images-to-PDF-using-ITextsharp.aspx) Read More

0

this is a software. I want to write code behind button to achieve my task...

0

ABCpdf - it's a PDF component for ASP.NET, suitable for use in multi-threaded environments.

One way you could convert your ASPX page would be to simply pass the URL to the AddImageUrl function. Something like...

Doc theDoc = new Doc();
theDoc.AddImageUrl("http://www.example.com/somepage.aspx");
theDoc.Save(Server.MapPath("htmlimport.pdf"));
theDoc.Clear();

There's a slightly more complex multi-page example to be found in the product documentation, written in C# and VB.NET

The component makes use of the Trident and Gecko rendering engines, so the PDF generated should match what you'd expect to see in Internet Explorer or FireFox. If you want to find out immediately how ABCpdf will render your web page, try out the online demonstration - no need to install anything.

Disclosures, past and present: see profile ;-)

Edited by LaxLoafer

0

I put your code behind the button ... The following error occurs when i run my project
"CS0246: The type or namespace name 'Doc' could not be found (are you missing a using directive or an assembly reference?)"

0

Did you add a reference to the component from your Visual Studio project? Right-click on your project in the solution explorer and select 'Add reference...', look for WebSupergoo.ABCpdf under the .NET tab.

It's useful to include some namespaces also, so add the following to the top of your C# code file...

using WebSupergoo.ABCpdf8;
using WebSupergoo.ABCpdf8.Objects;
using WebSupergoo.ABCpdf8.Atoms;
using WebSupergoo.ABCpdf8.Operations;

or for VB.NET...

Imports WebSupergoo.ABCpdf8
Imports WebSupergoo.ABCpdf8.Objects
Imports WebSupergoo.ABCpdf8.Atoms
Imports WebSupergoo.ABCpdf8.Operations

The 'Getting Started' section of the documentation provides some further help.

0

There is no component of name "WebSupergoo.ABCpdf" under the .NET tab.
I include the following name spaces :
using WebSupergoo.ABCpdf8;
using WebSupergoo.ABCpdf8.Objects;
using WebSupergoo.ABCpdf8.Atoms;
using WebSupergoo.ABCpdf8.Operations;

and when i run the project.. again i found error :
CS0246: The type or namespace name 'WebSupergoo' could not be found (are you missing a using directive or an assembly reference?)

0

Hi Sania

ABCpdf installs itself to the global assembly cache (GAC) by default. Open up the Add Reference dialog, select the browse tab and navigate to...
C:\Windows\assembly\GAC_MSIL\ABCpdf\
There you should find a subfolder, named '8.1.1.6__a7a0b3f5184f2169' or similar, inside which is the ABCpdf DLL. Add it as a reference to your project.

Which version of Visual Studio are you using?

Edited by LaxLoafer

-1

Disclaimer: I'm working for this company.

Hi :) alternatively, you could use PDF Metamorphosis .Net for this. The component transform Images and HTML to PDF. PDF Vision .Net is absolutely standalone and independent C# component. It doesn't require anything else.
Here you can find more code samples.

Sample code for the converting:

   SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();
        //get content of the ASPX page in HTML format
        string htmlString = GetHtmlFromAspx(Path.Combine(Server.MapPath(""), @"Default.aspx"));

        p.HtmlOptions.BaseUrl = Server.MapPath("");

        byte[] pdfBytes = p.HtmlToPdfConvertStringToByte(htmlString);
        //show PDF
        if (pdfBytes != null)
        {
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = "application/PDF";
            Response.BinaryWrite(pdfBytes);
            Response.Flush();
            Response.End();
        }

Cheer! :)
/Jane/

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.