Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:39:04+00:00 2026-06-17T11:39:04+00:00

first of all the current state: I have a MVC4 webapplication (online calculator) with

  • 0

first of all the current state:

  • I have a MVC4 webapplication (online calculator) with razor engine
  • the application has a resultview which shows the calculated results
  • I have the abbility to use ABCPDF 8.1
  • To manipulate DOM I use the HtmlAgilityPack

The goal is: inside the ResultController, get the current views html, manipulate its DOM (especially remove navigation elements) and generate a fully formatted pdf.

Following things work:

Create a fully css styled pdf from a URL

var document  = new Doc();
document.AddImageUrl("www.whatever.com");
return File(doc.GetData(), "application/pdf", "abc.pdf");

Create a pdf from a views html with manipulated DOM without the specific CSS3 formattings

using (StringWriter sw = new StringWriter())
{

    // get html stream from view
    var result = ViewEngines.Engines.FindView(ControllerContext, "WizardFirstStep", "_Layout");
    var context = new ViewContext(ControllerContext, result.View, ViewData, TempData, sw);
    result.View.Render(context, sw);
    var html = sw.ToString();

    // manipulate DOM with HtmlAgilityPack
    var hdoc = new HtmlDocument();
    hdoc.LoadHtml(html);
    ... manipulation

    // create pdf and return FileContentResult
    var doc = new Doc();
    doc.AddImageHtml(hdoc.DocumentNode.InnerHtml);
    return File(doc.GetData(), "application/pdf", "abc.pdf");
}

So I can create a styled html site as pdf and i can create a manipulated non-styled html file as pdf.

AddImageUrl uses css

AddImageHtml doesn’t use the css

I’ll be glad about every approach and solution

//edit:

I have a quick workaround for this problem. Instead of @Styles.Render the css relative with

@Styles.Render("~/Content/css")

I absolutely address the stylesheet

@Styles.Render("http://localhost:53406/Content/Site.css")

But maybe there are other solutions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:39:04+00:00Added an answer on June 17, 2026 at 11:39 am

    Since this is MVC and everything can be controlled through URL, I say load the document as a URL rather than an image.

    theDoc.AddImageUrl("http://www.google.com/")
    

    This way ABCpdf loads the page the way you see it. Unless there are scripts and whatnot that control the view, then you’d need to configure the document for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, apologize because I have seen some posts about this, but I
For a current MVC3 project I have a model that has multiple pages for
I have a program that uses an external API which uses its own state.
First of all, merry christmas to all of you :) I have a blog,
In my current rails app, I have a User model which has_one :user_detail. Currently,
First of all, this isn't for a keylogger, it's for an input in a
first of all some details: I configured security as below in web.xml view plaincopy
First of all, I'm quite new to the Android and JAVA world (coming from
first of all i would like to say i know its probably an easy
First of all there is probably a question like this already but i couldn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.